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, TIME_FORMAT
+ get_arg, RenderMixin, get_format, get_mutable_type, render_time
class URIHandler(RenderMixin, rend.Page):
addSlash = True
docFactory = getxmlfile("welcome.xhtml")
+ _connectedalts = {
+ "not-configured": "Not Configured",
+ "yes": "Connected",
+ "no": "Disconnected",
+ }
+
def __init__(self, client, clock=None):
rend.Page.__init__(self, client)
self.client = client
# 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())
+ return render_time(time.time())
def data_version(self, ctx, data):
return get_package_versions_string()
def data_import_path(self, ctx, data):
return "yes"
return "no"
+ def data_connected_to_introducer_alt(self, ctx, data):
+ return self._connectedalts[self.data_connected_to_introducer(ctx, data)]
+
def data_helper_furl_prefix(self, ctx, data):
try:
uploader = self.client.getServiceNamed("uploader")
return "yes"
return "no"
+ def data_connected_to_helper_alt(self, ctx, data):
+ return self._connectedalts[self.data_connected_to_helper(ctx, data)]
+
def data_known_storage_servers(self, ctx, data):
sb = self.client.get_storage_broker()
return len(sb.get_all_serverids())
available_space = abbreviate_size(available_space)
ctx.fillSlots("address", addr)
ctx.fillSlots("connected", connected)
+ ctx.fillSlots("connected_alt", self._connectedalts[connected])
ctx.fillSlots("connected-bool", bool(rhost))
- ctx.fillSlots("since", time.strftime(TIME_FORMAT,
- time.localtime(since)))
- ctx.fillSlots("announced", time.strftime(TIME_FORMAT,
- time.localtime(announced)))
+ ctx.fillSlots("since", render_time(since))
+ ctx.fillSlots("announced", render_time(announced))
ctx.fillSlots("version", version)
ctx.fillSlots("service_name", service_name)
ctx.fillSlots("available_space", available_space)