Skip to content

Commit

Permalink
FIxed #6513 -- Handle overflows better in the floatformat filter. It'…
Browse files Browse the repository at this point in the history
…s not

possible to test this automatically everywhere due to differing representations
on different platforms. Manual testing confirms it works, though.

Thanks, Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Mar 20, 2008
1 parent 463a03d commit 516102d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion django/template/defaultfilters.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def floatformat(text, arg=-1):
d = int(arg)
except ValueError:
return force_unicode(f)
m = f - int(f)
try:
m = f - int(f)
except OverflowError:
return force_unicode(f)
if not m and d < 0:
return mark_safe(u'%d' % int(f))
else:
Expand Down

0 comments on commit 516102d

Please sign in to comment.