#8557: intpoint filter for contrib.humanize
-----------------------------+----------------------------------------------
Reporter: drakkan | Owner: nobody
Status: new | Milestone: 1.0
Component: Template system | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 1 |
-----------------------------+----------------------------------------------
for european users would be really useful an intpoint filter in
contrib.humanize,
here is the necessary code (similar to intcomma)
def intpoint(value):
"""
Converts an integer to a string containing point 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 intpoint(new)
intpoint.is_safe = True
register.filter(intpoint)
hope this would be in 1.0,
thanks
drakkan
--
Ticket URL: <http://code.djangoproject.com/ticket/8557>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---