]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web status: abbreviate file size in the upload+download summary page
authorBrian Warner <warner@allmydata.com>
Wed, 7 May 2008 20:53:58 +0000 (13:53 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 7 May 2008 20:53:58 +0000 (13:53 -0700)
src/allmydata/web/status.py

index e3761e96f1c983b541e90a33c05ef72046b91916..020be4a1a8747c45029835b5592390e7da683b6f 100644 (file)
@@ -206,7 +206,7 @@ class UploadStatusPage(UploadResultsRendererMixin, rend.Page):
     def render_total_size(self, ctx, data):
         size = data.get_size()
         if size is None:
-            size = "(unknown)"
+            return "(unknown)"
         return size
 
     def render_progress_hash(self, ctx, data):
@@ -394,7 +394,7 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
     def render_total_size(self, ctx, data):
         size = data.get_size()
         if size is None:
-            size = "(unknown)"
+            return "(unknown)"
         return size
 
     def render_progress(self, ctx, data):
@@ -815,6 +815,8 @@ class Status(rend.Page):
         size = s.get_size()
         if size is None:
             size = "(unknown)"
+        elif isinstance(size, (int, long, float)):
+            size = abbreviate_size(size)
         ctx.fillSlots("total_size", size)
 
         progress = data.get_progress()