I use similar functions for some of my template filters, but I use locale instead.
import locale locale.setlocale(locale.LC_ALL, '') def whole_currency(value): return locale.format_string("$%0.f", value, grouping=True) def decimal_currency(value): return locale.format_string("$%0.2f", value, grouping=True) keith On Thu, Aug 28, 2008 at 10:12 AM, Nicola Murino <[EMAIL PROTECTED]>wrote: > > I think for european user an intpoint function in contrib.humanize > would be very useful > > here is the code (copied from intcomma) > > def intpoint(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 intpoint(new) > intpoint.is_safe = True > register.filter(intpoint) > > regards > Nicola > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---