From e6740cb39c94bb404797e6baed7bcdf534c422ed Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 13 Feb 2010 14:37:17 +0000 Subject: Fixed #11944 -- Improved exception handling for the filesizeformat filter. Thanks to rfk for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12426 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/template/defaultfilters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django') diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 0ba16bc9a5..e6492dcd38 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -799,7 +799,7 @@ def filesizeformat(bytes): """ try: bytes = float(bytes) - except TypeError: + except (TypeError,ValueError,UnicodeDecodeError): return u"0 bytes" if bytes < 1024: -- cgit v1.3