[Mpuls-commits] r774 - in wasko/branches/2.0: . waskaweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jan 19 21:09:27 CET 2010
Author: bh
Date: 2010-01-19 21:09:26 +0100 (Tue, 19 Jan 2010)
New Revision: 774
Modified:
wasko/branches/2.0/ChangeLog.txt
wasko/branches/2.0/waskaweb/lib/helpers.py
Log:
* waskaweb/lib/helpers.py (date2str, time2str, datetime2str)
(format_date, format_time, format_datetime): The format_*
functions are basically just aliases for the *2str functions.
However, it's the format_* functions that are actually used. So
basically rename the *2str functions to the corresponding format_*
functions and implement them more consistently, in particular
always log errors.
Modified: wasko/branches/2.0/ChangeLog.txt
===================================================================
--- wasko/branches/2.0/ChangeLog.txt 2010-01-19 19:54:08 UTC (rev 773)
+++ wasko/branches/2.0/ChangeLog.txt 2010-01-19 20:09:26 UTC (rev 774)
@@ -1,5 +1,15 @@
2010-01-19 Bernhard Herzog <bh at intevation.de>
+ * waskaweb/lib/helpers.py (date2str, time2str, datetime2str)
+ (format_date, format_time, format_datetime): The format_*
+ functions are basically just aliases for the *2str functions.
+ However, it's the format_* functions that are actually used. So
+ basically rename the *2str functions to the corresponding format_*
+ functions and implement them more consistently, in particular
+ always log errors.
+
+2010-01-19 Bernhard Herzog <bh at intevation.de>
+
* waskaweb/model/phases_factory.py (space_short),
waskaweb/lib/helpers.py (space_short): Move space_short from
helpers to phases_factory because that's the only place where it's
Modified: wasko/branches/2.0/waskaweb/lib/helpers.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/helpers.py 2010-01-19 19:54:08 UTC (rev 773)
+++ wasko/branches/2.0/waskaweb/lib/helpers.py 2010-01-19 20:09:26 UTC (rev 774)
@@ -130,43 +130,38 @@
return value
-def date2str(dt):
- if dt is None: return ''
+# Format functions
+def format_number(number):
+ retval = locale.format("%.2f",(number),1)
+ return retval
+
+def format_date(dt):
+ if dt is None:
+ return ''
try:
- #print "dt: %s fmt: %s" % (dt, locale.nl_langinfo(locale.D_FMT))
return dt.strftime(locale.nl_langinfo(locale.D_FMT))
except Exception, err:
log.error(err)
return dd_mm_YYYY(dt)
-def time2str(dt):
- if dt is None: return ''
+def format_time(dt):
+ if dt is None:
+ return ''
try:
return dt.strftime(locale.nl_langinfo(locale.T_FMT))
- except:
+ except Exception, err:
+ log.error(err)
return ''
-def datetime2str(dt):
- if dt is None: return ''
+def format_datetime(dt):
+ if dt is None:
+ return ''
try:
return dt.strftime(locale.nl_langinfo(locale.D_T_FMT))
- except:
+ except Exception, err:
+ log.error(err)
return dd_mm_yyyy_HH_MM(dt)
-# Format functions
-def format_number(number):
- retval = locale.format("%.2f",(number),1)
- return retval
-
-def format_date(dt):
- return date2str(dt)
-
-def format_time(dt):
- return time2str(dt)
-
-def format_datetime(dt):
- return datetime2str(dt)
-
def dd_mm_YYYY(d, empty = ''):
''' datetime.strftime() dislikes years before 1900. '''
if d is None: return empty
More information about the Mpuls-commits
mailing list