]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/web/introweb.py
wui: use standard time format (#1077)
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / web / introweb.py
index bbe42d0bb9da1dbfd41b2b211d80ef377181eac0..2cfe6a55fb58064b0a8d7668f14a94886db6650e 100644 (file)
@@ -7,7 +7,7 @@ import allmydata
 import simplejson
 from allmydata import get_package_versions_string
 from allmydata.util import idlib
-from allmydata.web.common import getxmlfile, get_arg, TIME_FORMAT
+from allmydata.web.common import getxmlfile, get_arg, render_time
 
 
 class IntroducerRoot(rend.Page):
@@ -42,34 +42,18 @@ class IntroducerRoot(rend.Page):
         res["subscription_summary"] = counts
 
         announcement_summary = {}
-        service_hosts = {}
         for ad in self.introducer_service.get_announcements():
             service_name = ad.service_name
             if service_name not in announcement_summary:
                 announcement_summary[service_name] = 0
             announcement_summary[service_name] += 1
-            if service_name not in service_hosts:
-                service_hosts[service_name] = set()
-            # it's nice to know how many distinct hosts are available for
-            # each service. We define a "host" by a set of addresses
-            # (hostnames or ipv4 addresses), which we extract from the
-            # connection hints. In practice, this is usually close
-            # enough: when multiple services are run on a single host,
-            # they're usually either configured with the same addresses,
-            # or setLocationAutomatically picks up the same interfaces.
-            host = frozenset(ad.advertised_addresses)
-            service_hosts[service_name].add(host)
         res["announcement_summary"] = announcement_summary
-        distinct_hosts = dict([(name, len(hosts))
-                               for (name, hosts)
-                               in service_hosts.iteritems()])
-        res["announcement_distinct_hosts"] = distinct_hosts
 
         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())
+        return render_time(time.time())
     def data_version(self, ctx, data):
         return get_package_versions_string()
     def data_import_path(self, ctx, data):
@@ -105,9 +89,10 @@ class IntroducerRoot(rend.Page):
     def render_service_row(self, ctx, ad):
         ctx.fillSlots("serverid", ad.serverid)
         ctx.fillSlots("nickname", ad.nickname)
-        ctx.fillSlots("advertised", " ".join(ad.advertised_addresses))
+        ctx.fillSlots("connection-hints",
+                      "connection hints: " + " ".join(ad.connection_hints))
         ctx.fillSlots("connected", "?")
-        when_s = time.strftime("%H:%M:%S %d-%b-%Y", time.localtime(ad.when))
+        when_s = render_time(ad.when)
         ctx.fillSlots("announced", when_s)
         ctx.fillSlots("version", ad.version)
         ctx.fillSlots("service_name", ad.service_name)
@@ -120,7 +105,7 @@ class IntroducerRoot(rend.Page):
         ctx.fillSlots("nickname", s.nickname)
         ctx.fillSlots("tubid", s.tubid)
         ctx.fillSlots("connected", s.remote_address)
-        since_s = time.strftime("%H:%M:%S %d-%b-%Y", time.localtime(s.when))
+        since_s = render_time(s.when)
         ctx.fillSlots("since", since_s)
         ctx.fillSlots("version", s.version)
         ctx.fillSlots("service_name", s.service_name)