[Mpuls-commits] r5510 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Oct 28 14:47:07 CEST 2011
Author: bricks
Date: 2011-10-28 14:47:07 +0200 (Fri, 28 Oct 2011)
New Revision: 5510
Modified:
base/trunk/mpulsweb/lib/export.py
Log:
Use same encode method for FormletterXLSTable and XLSTable
To also handle date, int and float values correctly for all excel export
move the encode method from FormletterXLSTable to the XLSTable class.
FormletterXLSTable is obsolete now.
Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py 2011-10-28 12:18:47 UTC (rev 5509)
+++ base/trunk/mpulsweb/lib/export.py 2011-10-28 12:47:07 UTC (rev 5510)
@@ -188,8 +188,14 @@
style = pyExcelerator.XFStyle()
if value is None:
return ("", style)
+ if isinstance(value, (date, datetime)):
+ #style.num_format_str = "M/D/YY"
+ style.num_format_str = "DD.MM.YYYY"
+ return (value, style)
if isinstance(value, basestring) and len(value) > 32765:
value = value[:32765]
+ if not isinstance(value, (basestring, int, long, float)):
+ return (str(value), style)
return (value, style)
@@ -284,21 +290,8 @@
# Formletter Export
#
class FormletterXLSTable(XLSTable):
+ pass
- def encode(self, value):
- style = pyExcelerator.XFStyle()
- if value is None:
- return ("", style)
- if isinstance(value, (date, datetime)):
- #style.num_format_str = "M/D/YY"
- style.num_format_str = "DD.MM.YYYY"
- return (value, style)
- if isinstance(value, basestring) and len(value) > 32765:
- value = value[:32765]
- if not isinstance(value, (basestring, int, long, float)):
- return (str(value), style)
- return (value, style)
-
class FormletterExport(Export):
def __init__(self, data, order=None):
More information about the Mpuls-commits
mailing list