WUI: add time page was rendered to client and introducer welcome pages. closes #1972

Author: Leif Ryge <leif@synthesize.us>
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
This commit is contained in:
Daira Hopwood 2013-05-19 23:27:23 +01:00
parent 30924a506c
commit ec191bfca6
6 changed files with 17 additions and 3 deletions

View 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="status">Recent and Active Operations</a>', res)
self.failUnlessIn('<a href="statistics">Operational Statistics</a>', res) self.failUnlessIn('<a href="statistics">Operational Statistics</a>', res)
self.failUnlessIn('<input type="hidden" name="t" value="report-incident" />', 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') res_u = res.decode('utf-8')
self.failUnlessIn(u'<td>fake_nickname \u263A</td>', res_u) self.failUnlessIn(u'<td>fake_nickname \u263A</td>', res_u)
self.failUnlessIn(u'<div class="nickname">other_nickname \u263B</div>', 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): def _check(res):
self.failUnlessIn('Welcome to the Tahoe-LAFS Introducer', res) self.failUnlessIn('Welcome to the Tahoe-LAFS Introducer', res)
self.failUnlessIn(FAVICON_MARKUP, res) self.failUnlessIn(FAVICON_MARKUP, res)
self.failUnlessIn('Page rendered at', res)
self.failUnlessIn('Tahoe-LAFS code imported from:', res)
d.addCallback(_check) d.addCallback(_check)
return d return d

View File

@ -16,6 +16,9 @@ from allmydata.util import abbreviate
from allmydata.util.encodingutil import to_str, quote_output from allmydata.util.encodingutil import to_str, quote_output
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
class IOpHandleTable(Interface): class IOpHandleTable(Interface):
pass pass

View File

@ -76,5 +76,7 @@
</table> </table>
</div> </div>
<p class="minutia">Page rendered at <span n:render="data" n:data="rendered_at" /></p>
</body> </body>
</html> </html>

View File

@ -7,7 +7,8 @@ import allmydata
import simplejson import simplejson
from allmydata import get_package_versions_string from allmydata import get_package_versions_string
from allmydata.util import idlib 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): class IntroducerRoot(rend.Page):
@ -67,6 +68,8 @@ class IntroducerRoot(rend.Page):
return simplejson.dumps(res, indent=1) + "\n" return simplejson.dumps(res, indent=1) + "\n"
# FIXME: This code is duplicated in root.py and introweb.py. # 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): def data_version(self, ctx, data):
return get_package_versions_string() return get_package_versions_string()
def data_import_path(self, ctx, data): def data_import_path(self, ctx, data):

View File

@ -14,7 +14,7 @@ from allmydata.interfaces import IFileNode
from allmydata.web import filenode, directory, unlinked, status, operations from allmydata.web import filenode, directory, unlinked, status, operations
from allmydata.web import storage from allmydata.web import storage
from allmydata.web.common import abbreviate_size, getxmlfile, WebError, \ 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): class URIHandler(RenderMixin, rend.Page):
@ -164,6 +164,8 @@ class Root(rend.Page):
#child_server # let's reserve this for storage-server-over-HTTP #child_server # let's reserve this for storage-server-over-HTTP
# FIXME: This code is duplicated in root.py and introweb.py. # 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): def data_version(self, ctx, data):
return get_package_versions_string() return get_package_versions_string()
def data_import_path(self, ctx, data): def data_import_path(self, ctx, data):
@ -287,7 +289,6 @@ class Root(rend.Page):
version = announcement["my-version"] version = announcement["my-version"]
service_name = announcement["service-name"] service_name = announcement["service-name"]
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
ctx.fillSlots("address", addr) ctx.fillSlots("address", addr)
ctx.fillSlots("connected", connected) ctx.fillSlots("connected", connected)
ctx.fillSlots("connected-bool", bool(rhost)) ctx.fillSlots("connected-bool", bool(rhost))

View File

@ -195,6 +195,7 @@
<footer> <footer>
<p>&#169; <a href="https://tahoe-lafs.org/">Tahoe-LAFS Software Foundation 2013</a></p> <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" n:render="string" n:data="version"></p>
<p class="minutia">Tahoe-LAFS code imported from: <span n:render="data" n:data="import_path" /></p> <p class="minutia">Tahoe-LAFS code imported from: <span n:render="data" n:data="import_path" /></p>
</footer> </footer>