Ticket #6513: floatformat_catch_overflow.diff

File floatformat_catch_overflow.diff, 508 bytes (added by Karen Tracey <kmtracey@…>, 11 years ago)

Catch overflow error on attempt to floatformat infinity.

  • django/template/defaultfilters.py

     
    124124        d = int(arg)
    125125    except ValueError:
    126126        return force_unicode(f)
    127     m = f - int(f)
     127    try:
     128        m = f - int(f)
     129    except OverflowError:
     130        return force_unicode(f)
    128131    if not m and d < 0:
    129132        return mark_safe(u'%d' % int(f))
    130133    else:
Back to Top