From 1e4b904b1ab0197b4f21bf202483e9eb2c8466d3 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 7 May 2008 13:53:58 -0700
Subject: [PATCH] web status: abbreviate file size in the upload+download
 summary page

---
 src/allmydata/web/status.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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()
-- 
2.45.2