[Mpuls-commits] r3802 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Sep 28 10:08:57 CEST 2010
Author: torsten
Date: 2010-09-28 10:08:56 +0200 (Tue, 28 Sep 2010)
New Revision: 3802
Modified:
base/trunk/mpulsweb/lib/helpers.py
Log:
* mpulsweb/lib/helpers.py (format_number): Added optinal precision parameter.
Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py 2010-09-28 08:07:01 UTC (rev 3801)
+++ base/trunk/mpulsweb/lib/helpers.py 2010-09-28 08:08:56 UTC (rev 3802)
@@ -245,8 +245,9 @@
# Format functions
-def format_number(number):
- retval = locale.format("%.2f", (number), 1)
+def format_number(number, precision=2):
+ fmt = "%%.%sf" % precision
+ retval = locale.format(fmt, (number), 1)
return retval
def format_date(dt):
More information about the Mpuls-commits
mailing list