Ticket #11636: humanize.patch
File humanize.patch, 690 bytes (added by , 15 years ago) |
---|
-
.py
old new 37 37 intcomma.is_safe = True 38 38 register.filter(intcomma) 39 39 40 def intdot(value): 41 """ 42 Converts an integer to a string containing dots every three digits. 43 For example, 3000 becomes '3.000' and 45000 becomes '45.000'. 44 """ 45 orig = force_unicode(value) 46 new = re.sub("^(-?\d+)(\d{3})", '\g<1>.\g<2>', orig) 47 if orig == new: 48 return new 49 else: 50 return intdot(new) 51 intdot.is_safe = True 52 register.filter(intdot) 53 40 54 def intword(value): 41 55 """ 42 56 Converts a large integer to a friendly text representation. Works best for