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.util.time_format import format_time
+from allmydata.web.common import getxmlfile, get_arg
class IntroducerRoot(rend.Page):
# 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 format_time(time.localtime())
def data_version(self, ctx, data):
return get_package_versions_string()
def data_import_path(self, ctx, data):
import allmydata # to display import path
from allmydata import get_package_versions_string
from allmydata.util import log
+from allmydata.util.time_format import format_time
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, TIME_FORMAT
+ get_arg, RenderMixin, get_format, get_mutable_type
class URIHandler(RenderMixin, rend.Page):
# 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 format_time(time.localtime())
def data_version(self, ctx, data):
return get_package_versions_string()
def data_import_path(self, ctx, data):
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", format_time(time.localtime(since)))
+ ctx.fillSlots("announced", format_time(time.localtime(announced)))
ctx.fillSlots("version", version)
ctx.fillSlots("service_name", service_name)
ctx.fillSlots("available_space", available_space)
from twisted.internet import defer
from nevow import rend, inevow, tags as T
from allmydata.util import base32, idlib
+from allmydata.util.time_format import format_time
from allmydata.web.common import getxmlfile, get_arg, \
abbreviate_time, abbreviate_rate, abbreviate_size, plural, compute_rate
from allmydata.interfaces import IUploadStatus, IDownloadStatus, \
return d
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s
def render_si(self, ctx, data):
return d
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s + " (%s)" % data.get_started()
def render_si(self, ctx, data):
docFactory = getxmlfile("download-status-timeline.xhtml")
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s + " (%s)" % data.get_started()
def render_si(self, ctx, data):
self.retrieve_status = data
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s
def render_si(self, ctx, data):
self.publish_status = data
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s
def render_si(self, ctx, data):
self.update_status = data
def render_started(self, ctx, data):
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_started()))
+ started_s = format_time(time.localtime(data.get_started()))
return started_s
def render_finished(self, ctx, data):
when = data.get_finished()
if not when:
return "not yet"
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(data.get_finished()))
+ started_s = format_time(time.localtime(data.get_finished()))
return started_s
def render_si(self, ctx, data):
def render_row(self, ctx, data):
s = data
- TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
- started_s = time.strftime(TIME_FORMAT,
- time.localtime(s.get_started()))
+ started_s = format_time(time.localtime(s.get_started()))
ctx.fillSlots("started", started_s)
si_s = base32.b2a_or_none(s.get_storage_index())