WUI: add time page was rendered to client and introducer welcome pages. closes #1972
authorDaira Hopwood <david-sarah@jacaranda.org>
Sun, 19 May 2013 22:27:23 +0000 (23:27 +0100)
committerDaira Hopwood <david-sarah@jacaranda.org>
Sun, 19 May 2013 22:27:23 +0000 (23:27 +0100)
Author: Leif Ryge <leif@synthesize.us>
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
src/allmydata/test/test_web.py
src/allmydata/web/common.py
src/allmydata/web/introducer.xhtml
src/allmydata/web/introweb.py
src/allmydata/web/root.py
src/allmydata/web/welcome.xhtml

index 9db671c62c0e21f415a25282ba1fad512c0f9165..ba76b8c659922824af5e99d743a6b7556beacec0 100644 (file)
@@ -612,6 +612,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
             self.failUnlessIn('<a href="status">Recent and Active Operations</a>', res)
             self.failUnlessIn('<a href="statistics">Operational Statistics</a>', res)
             self.failUnlessIn('<input type="hidden" name="t" value="report-incident" />', res)
+            self.failUnlessIn('Page rendered at', res)
+            self.failUnlessIn('Tahoe-LAFS code imported from:', res)
             res_u = res.decode('utf-8')
             self.failUnlessIn(u'<td>fake_nickname \u263A</td>', res_u)
             self.failUnlessIn(u'<div class="nickname">other_nickname \u263B</div>', 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
 
index c3b94d2a36957c238a1355a5332096231f968e8e..be6df366df1c7da9a8f27efe80e8cb6ff4a00a5f 100644 (file)
@@ -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
 
index 9be4388f41b4284693aae7743cfd5e45786c8880..e89e88c3be2f00969619108b6a44dffbdaab71be 100644 (file)
@@ -76,5 +76,7 @@
 </table>
 </div>
 
+<p class="minutia">Page rendered at <span n:render="data" n:data="rendered_at" /></p>
+
   </body>
 </html>
index 843fd0e03b3a7568ad57dbbf82a31c21c843a75b..cc8b2ce15ebf32e107dd835fdb80f97a83addbf5 100644 (file)
@@ -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):
index 03ff87f0927d46edf52c838af2c0ca28b822d266..9495d3dfc93fd2244f637004773b7e21536a147c 100644 (file)
@@ -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))
index 0b796b2282a5154c7a22dbf0dbd4b63c456cbee8..1cb99d8b534e631770d4ccf2aa0e05cfea9c1ca6 100644 (file)
 
       <footer>
         <p>&#169; <a href="https://tahoe-lafs.org/">Tahoe-LAFS Software Foundation 2013</a></p>
+        <p class="minutia">Page rendered at <span n:render="data" n:data="rendered_at" /></p>
         <p class="minutia" n:render="string" n:data="version"></p>
         <p class="minutia">Tahoe-LAFS code imported from: <span n:render="data" n:data="import_path" /></p>
       </footer>