From: Brian Warner <warner@allmydata.com>
Date: Wed, 7 May 2008 20:53:58 +0000 (-0700)
Subject: web status: abbreviate file size in the upload+download summary page
X-Git-Tag: allmydata-tahoe-1.1.0~154
X-Git-Url: https://git.rkrishnan.org/components/%22news.html//%22?a=commitdiff_plain;h=1e4b904b1ab0197b4f21bf202483e9eb2c8466d3;p=tahoe-lafs%2Ftahoe-lafs.git

web status: abbreviate file size in the upload+download summary page
---

diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py
index e3761e96..020be4a1 100644
--- a/src/allmydata/web/status.py
+++ b/src/allmydata/web/status.py
@@ -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()