web: move plural() to common.py
authorBrian Warner <warner@lothar.com>
Wed, 4 Mar 2009 02:40:19 +0000 (19:40 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 4 Mar 2009 02:40:19 +0000 (19:40 -0700)
src/allmydata/web/common.py
src/allmydata/web/status.py

index ec86d46a5785d8230eb4438194990e05d5b215cb..5f7e76e6ca60249226dbdff58f6af08dfd2bef4a 100644 (file)
@@ -81,6 +81,15 @@ def abbreviate_size(data):
         return "%.1fkB" % (r/1000)
     return "%dB" % r
 
+def plural(sequence_or_length):
+    if isinstance(sequence_or_length, int):
+        length = sequence_or_length
+    else:
+        length = len(sequence_or_length)
+    if length == 1:
+        return ""
+    return "s"
+
 def text_plain(text, ctx):
     req = IRequest(ctx)
     req.setHeader("content-type", "text/plain")
index d5ce1c697b1cf3693590a086238275dd30b1f391..4fba764c1f47503636490dd8e4972ed3f0ce4ba4 100644 (file)
@@ -5,19 +5,10 @@ from twisted.internet import defer
 from nevow import rend, inevow, tags as T
 from allmydata.util import base32, idlib
 from allmydata.web.common import getxmlfile, get_arg, \
-     abbreviate_time, abbreviate_rate, abbreviate_size
+     abbreviate_time, abbreviate_rate, abbreviate_size, plural
 from allmydata.interfaces import IUploadStatus, IDownloadStatus, \
      IPublishStatus, IRetrieveStatus, IServermapUpdaterStatus
 
-def plural(sequence_or_length):
-    if isinstance(sequence_or_length, int):
-        length = sequence_or_length
-    else:
-        length = len(sequence_or_length)
-    if length == 1:
-        return ""
-    return "s"
-
 class RateAndTimeMixin:
 
     def render_time(self, ctx, data):