started downloads."""
class IUploadStatus(Interface):
+ def get_started():
+ """Return a timestamp (float with seconds since epoch) indicating
+ when the operation was started."""
def get_storage_index():
"""Return a string with the (binary) storage index in use on this
upload. Returns None if the storage index has not yet been
page can generate a suitable hyperlink."""
class IDownloadStatus(Interface):
+ def get_started():
+ """Return a timestamp (float with seconds since epoch) indicating
+ when the operation was started."""
def get_storage_index():
"""Return a string with the (binary) storage index in use on this
download. This may be None if there is no storage index (i.e. LIT
self.status = "Not started"
self.progress = 0.0
self.counter = self.statusid_counter.next()
+ self.started = time.time()
+ def get_started(self):
+ return self.started
def get_storage_index(self):
return self.storage_index
def using_helper(self):
self.status = "Not started"
self.progress = 0.0
self.counter = self.statusid_counter.next()
+ self.started = time.time()
+ def get_started(self):
+ return self.started
def get_storage_index(self):
return self.storage_index
def using_helper(self):
d.addCallback(_got_results)
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()))
+ return started_s
+
def render_si(self, ctx, data):
si_s = base32.b2a_or_none(data.get_storage_index())
if si_s is None:
d.addCallback(_got_results)
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()))
+ return started_s
+
def render_si(self, ctx, data):
si_s = base32.b2a_or_none(data.get_storage_index())
if si_s is None:
class RetrieveStatusPage(rend.Page):
docFactory = getxmlfile("retrieve-status.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()))
+ return started_s
+
def render_si(self, ctx, data):
si_s = base32.b2a_or_none(data.get_storage_index())
if si_s is None:
class PublishStatusPage(rend.Page):
docFactory = getxmlfile("publish-status.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()))
+ return started_s
+
def render_si(self, ctx, data):
si_s = base32.b2a_or_none(data.get_storage_index())
if si_s is None:
IClient(ctx).list_recent_publish() +
IClient(ctx).list_recent_retrieve())
if not o.get_active()]
+ recent.sort(lambda a,b: cmp(a.get_started(), b.get_started()))
+ recent.reverse()
return recent
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()))
+ ctx.fillSlots("started", started_s)
+
si_s = base32.b2a_or_none(s.get_storage_index())
if si_s is None:
si_s = "(None)"