summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-02-13 14:44:07 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-02-13 14:44:07 +0000
commit166405b2e4197fba7d5638ee732f2170f8647f62 (patch)
treebdc69d1cf37e925c7d66a7b371afce945588745f /django
parentf30a4b368cd6a03dfbbfd2145d06f747664ece86 (diff)
[1.1.X] Fixed #11944 -- Improved exception handling for the filesizeformat filter. Thanks to rfk for the report and patch.
Backport of r12426 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/template/defaultfilters.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index a8c25670f6..03a294bc28 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -792,7 +792,7 @@ def filesizeformat(bytes):
"""
try:
bytes = float(bytes)
- except TypeError:
+ except (TypeError,ValueError,UnicodeDecodeError):
return u"0 bytes"
if bytes < 1024: