id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 19282,intcomma for decimal no longer works as expected,judy,hernantz,"intcomma used to work for decimals, but this has been broken somewhere between django 1.2.3 and django 1.4... e.g. {{{ >>> from decimal import Decimal >>> i = Decimal(""1233566.22"") >>> intcomma(i) u'1,233,566' }}} I guess technically the name is intcomma, so maybe it was officially only supposed to work for integers; however it appears that intcomma specifically supports floats: {{{ >>> i = 12356333.44 >>> intcomma(i) u'12,356,333.44' }}} for reference --- Old humanize.py: {{{ def intcomma(value): """""" Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """""" orig = force_unicode(value) new = re.sub(""^(-?\d+)(\d{3})"", '\g<1>,\g<2>', orig) if orig == new: return new else: return intcomma(new) }}} New humanize.py (note that it specifically mentions float.. perhaps we could specifically mention decimal as well??): {{{ def intcomma(value, use_l10n=True): """""" Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """""" if settings.USE_L10N and use_l10n: try: if not isinstance(value, float): value = int(value) except (TypeError, ValueError): return intcomma(value, False) else: return number_format(value, force_grouping=True) orig = force_unicode(value) new = re.sub(""^(-?\d+)(\d{3})"", '\g<1>,\g<2>', orig) if orig == new: return new else: return intcomma(new, use_l10n) }}} ",Cleanup/optimization,closed,contrib.humanize,1.4,Normal,fixed,"intcomma, humanize, decimal, sprints-django-ar",,Ready for checkin,1,0,0,0,0,0