Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a regression introduced in r16897. Thanks to Julien for the eag…

…le eyes and Florian Apolloner for the review.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ce9e3b4e9753f9b3bf2e5d8677dfbbabb0c6e33f 1 parent f2ed107
@jezdez jezdez authored
Showing with 26 additions and 26 deletions.
  1. +26 −26 django/contrib/humanize/templatetags/humanize.py
View
52 django/contrib/humanize/templatetags/humanize.py
@@ -51,53 +51,53 @@ def intcomma(value, use_l10n=True):
intcomma.is_safe = True
register.filter(intcomma)
-# A dictionary of standard large number to their converters
-intword_converters = {
- 6: lambda number: (
+# A tuple of standard large number to their converters
+intword_converters = (
+ (6, lambda number: (
ungettext('%(value).1f million', '%(value).1f million', number),
ungettext('%(value)s million', '%(value)s million', number),
- ),
- 9: lambda number: (
+ )),
+ (9, lambda number: (
ungettext('%(value).1f billion', '%(value).1f billion', number),
ungettext('%(value)s billion', '%(value)s billion', number),
- ),
- 12: lambda number: (
+ )),
+ (12, lambda number: (
ungettext('%(value).1f trillion', '%(value).1f trillion', number),
ungettext('%(value)s trillion', '%(value)s trillion', number),
- ),
- 15: lambda number: (
+ )),
+ (15, lambda number: (
ungettext('%(value).1f quadrillion', '%(value).1f quadrillion', number),
ungettext('%(value)s quadrillion', '%(value)s quadrillion', number),
- ),
- 18: lambda number: (
+ )),
+ (18, lambda number: (
ungettext('%(value).1f quintillion', '%(value).1f quintillion', number),
ungettext('%(value)s quintillion', '%(value)s quintillion', number),
- ),
- 21: lambda number: (
+ )),
+ (21, lambda number: (
ungettext('%(value).1f sextillion', '%(value).1f sextillion', number),
ungettext('%(value)s sextillion', '%(value)s sextillion', number),
- ),
- 24: lambda number: (
+ )),
+ (24, lambda number: (
ungettext('%(value).1f septillion', '%(value).1f septillion', number),
ungettext('%(value)s septillion', '%(value)s septillion', number),
- ),
- 27: lambda number: (
+ )),
+ (27, lambda number: (
ungettext('%(value).1f octillion', '%(value).1f octillion', number),
ungettext('%(value)s octillion', '%(value)s octillion', number),
- ),
- 30: lambda number: (
+ )),
+ (30, lambda number: (
ungettext('%(value).1f nonillion', '%(value).1f nonillion', number),
ungettext('%(value)s nonillion', '%(value)s nonillion', number),
- ),
- 33: lambda number: (
+ )),
+ (33, lambda number: (
ungettext('%(value).1f decillion', '%(value).1f decillion', number),
ungettext('%(value)s decillion', '%(value)s decillion', number),
- ),
- 100: lambda number: (
+ )),
+ (100, lambda number: (
ungettext('%(value).1f googol', '%(value).1f googol', number),
ungettext('%(value)s googol', '%(value)s googol', number),
- ),
-}
+ )),
+)
def intword(value):
"""
@@ -124,7 +124,7 @@ def _check_for_i18n(value, float_formatted, string_formatted):
template = float_formatted
return template % {'value': value}
- for exponent, converters in intword_converters.items():
+ for exponent, converters in intword_converters:
large_number = 10 ** exponent
if value < large_number * 1000:
new_value = value / float(large_number)
Please sign in to comment.
Something went wrong with that request. Please try again.