From 1e885fa40b7417b8ad119ae1ff7f9f44f1dc4ff5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 25 Jul 2017 11:16:38 -0400 Subject: [PATCH] Convert storage.py over to MultiFormatPage --- src/allmydata/web/storage.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index 9eb2ddf35..b6e2b0ac8 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -1,7 +1,11 @@ import time, json -from nevow import rend, tags as T, inevow -from allmydata.web.common import getxmlfile, abbreviate_time, get_arg +from nevow import rend, tags as T +from allmydata.web.common import ( + getxmlfile, + abbreviate_time, + MultiFormatPage, +) from allmydata.util.abbreviate import abbreviate_space from allmydata.util import time_format, idlib @@ -10,7 +14,7 @@ def remove_prefix(s, prefix): return None return s[len(prefix):] -class StorageStatus(rend.Page): +class StorageStatus(MultiFormatPage): docFactory = getxmlfile("storage_status.xhtml") # the default 'data' argument is the StorageServer instance @@ -19,13 +23,6 @@ class StorageStatus(rend.Page): self.storage = storage self.nickname = nickname - def renderHTTP(self, ctx): - req = inevow.IRequest(ctx) - t = get_arg(req, "t") - if t == "json": - return self.render_JSON(req) - return rend.Page.renderHTTP(self, ctx) - def render_JSON(self, req): req.setHeader("content-type", "text/plain") d = {"stats": self.storage.get_stats(), @@ -266,4 +263,3 @@ class StorageStatus(rend.Page): ]]]) return ctx.tag[p] -