[Mpuls-commits] r5537 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 4 10:45:14 CET 2011


Author: ludwig
Date: 2011-11-04 10:45:12 +0100 (Fri, 04 Nov 2011)
New Revision: 5537

Modified:
   base/trunk/mpulsweb/lib/export.py
Log:
Issue 2538: At the xls export convert date into datetime.
pyExcelarator doesn't support date, but datetime.


Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py	2011-11-04 08:40:16 UTC (rev 5536)
+++ base/trunk/mpulsweb/lib/export.py	2011-11-04 09:45:12 UTC (rev 5537)
@@ -188,10 +188,14 @@
         style = pyExcelerator.XFStyle()
         if value is None:
             return ("", style)
-        if isinstance(value, (date, datetime)):
+        if isinstance(value, datetime):
             #style.num_format_str = "M/D/YY"
             style.num_format_str = "DD.MM.YYYY"
             return (value, style)
+        if isinstance(value, date):
+            style.num_format_str = "DD.MM.YYYY"
+            value = datetime(value.year, value.month, value.day)
+            return (value, style)
         if isinstance(value, basestring) and len(value) > 32765:
             value = value[:32765]
         if not isinstance(value, (basestring, int, long, float)):



More information about the Mpuls-commits mailing list