From: Daira Hopwood Date: Sun, 19 May 2013 22:27:23 +0000 (+0100) Subject: WUI: add time page was rendered to client and introducer welcome pages. closes #1972 X-Git-Tag: allmydata-tahoe-1.10.1a1~239 X-Git-Url: https://git.rkrishnan.org/pf/content/%22news.html/frontends/index.php?a=commitdiff_plain;h=ec191bfca6e1cd3d31b4f206c56304caa69c82cf;p=tahoe-lafs%2Ftahoe-lafs.git WUI: add time page was rendered to client and introducer welcome pages. closes #1972 Author: Leif Ryge Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 9db671c6..ba76b8c6 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -612,6 +612,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnlessIn('Recent and Active Operations', res) self.failUnlessIn('Operational Statistics', res) self.failUnlessIn('', res) + self.failUnlessIn('Page rendered at', res) + self.failUnlessIn('Tahoe-LAFS code imported from:', res) res_u = res.decode('utf-8') self.failUnlessIn(u'fake_nickname \u263A', res_u) self.failUnlessIn(u'
other_nickname \u263B
', res_u) @@ -4421,6 +4423,8 @@ class IntroducerWeb(unittest.TestCase): def _check(res): self.failUnlessIn('Welcome to the Tahoe-LAFS Introducer', res) self.failUnlessIn(FAVICON_MARKUP, res) + self.failUnlessIn('Page rendered at', res) + self.failUnlessIn('Tahoe-LAFS code imported from:', res) d.addCallback(_check) return d diff --git a/src/allmydata/web/common.py b/src/allmydata/web/common.py index c3b94d2a..be6df366 100644 --- a/src/allmydata/web/common.py +++ b/src/allmydata/web/common.py @@ -16,6 +16,9 @@ from allmydata.util import abbreviate from allmydata.util.encodingutil import to_str, quote_output +TIME_FORMAT = "%H:%M:%S %d-%b-%Y" + + class IOpHandleTable(Interface): pass diff --git a/src/allmydata/web/introducer.xhtml b/src/allmydata/web/introducer.xhtml index 9be4388f..e89e88c3 100644 --- a/src/allmydata/web/introducer.xhtml +++ b/src/allmydata/web/introducer.xhtml @@ -76,5 +76,7 @@ +

Page rendered at

+ diff --git a/src/allmydata/web/introweb.py b/src/allmydata/web/introweb.py index 843fd0e0..cc8b2ce1 100644 --- a/src/allmydata/web/introweb.py +++ b/src/allmydata/web/introweb.py @@ -7,7 +7,8 @@ import allmydata import simplejson from allmydata import get_package_versions_string from allmydata.util import idlib -from allmydata.web.common import getxmlfile, get_arg +from allmydata.web.common import getxmlfile, get_arg, TIME_FORMAT + class IntroducerRoot(rend.Page): @@ -67,6 +68,8 @@ class IntroducerRoot(rend.Page): return simplejson.dumps(res, indent=1) + "\n" # FIXME: This code is duplicated in root.py and introweb.py. + def data_rendered_at(self, ctx, data): + return time.strftime(TIME_FORMAT, time.localtime()) def data_version(self, ctx, data): return get_package_versions_string() def data_import_path(self, ctx, data): diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 03ff87f0..9495d3df 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -14,7 +14,7 @@ from allmydata.interfaces import IFileNode from allmydata.web import filenode, directory, unlinked, status, operations from allmydata.web import storage from allmydata.web.common import abbreviate_size, getxmlfile, WebError, \ - get_arg, RenderMixin, get_format, get_mutable_type + get_arg, RenderMixin, get_format, get_mutable_type, TIME_FORMAT class URIHandler(RenderMixin, rend.Page): @@ -164,6 +164,8 @@ class Root(rend.Page): #child_server # let's reserve this for storage-server-over-HTTP # FIXME: This code is duplicated in root.py and introweb.py. + def data_rendered_at(self, ctx, data): + return time.strftime(TIME_FORMAT, time.localtime()) def data_version(self, ctx, data): return get_package_versions_string() def data_import_path(self, ctx, data): @@ -287,7 +289,6 @@ class Root(rend.Page): version = announcement["my-version"] service_name = announcement["service-name"] - TIME_FORMAT = "%H:%M:%S %d-%b-%Y" ctx.fillSlots("address", addr) ctx.fillSlots("connected", connected) ctx.fillSlots("connected-bool", bool(rhost)) diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index 0b796b22..1cb99d8b 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -195,6 +195,7 @@