#8557 closed (duplicate)
intpoint filter for contrib.humanize
| Reported by: | Nicola | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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
Change History (5)
comment:1 by , 17 years ago
| milestone: | 1.0 |
|---|
comment:2 by , 17 years ago
| milestone: | → post-1.0 |
|---|
comment:3 by , 17 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
Note:
See TracTickets
for help on using tickets.
We're well past feature freeze for 1.0.