summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-12-22 20:08:58 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-12-22 20:08:58 -0500
commitd3c35bc608b6eaf299e66146e1aab76d43b69211 (patch)
tree8247379f7a68391a4a5db7f8f7a80756ee7b9f87 /mirrors
parentb2b6c78e3179cef66cd4e9dcea7f9003f409ce8b (diff)
parent9adc2e53124daa6d13090166830396ffff9013d3 (diff)
Merge tag 'release_2013-11-30' into archweb-generic
End of month release, perf fixes
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/templatetags/mirror_status.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mirrors/templatetags/mirror_status.py b/mirrors/templatetags/mirror_status.py
index 9a363fbe..b3810d9a 100644
--- a/mirrors/templatetags/mirror_status.py
+++ b/mirrors/templatetags/mirror_status.py
@@ -1,6 +1,5 @@
from datetime import timedelta
from django import template
-from django.template.defaultfilters import floatformat
register = template.Library()
@@ -27,10 +26,16 @@ def hours(value):
return '%d hours' % hrs
@register.filter
-def percentage(value, arg=-1):
+def floatvalue(value, arg=2):
+ if value is None:
+ return u''
+ return '%.*f' % (arg, value)
+
+@register.filter
+def percentage(value, arg=1):
if not value and type(value) != float:
return u''
new_val = value * 100.0
- return floatformat(new_val, arg) + '%'
+ return '%.*f%%' % (arg, new_val)
# vim: set ts=4 sw=4 et: