[Erp5-report] r17867 - /erp5/trunk/products/ERP5Type/patches/sqlvar.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 28 15:17:15 CET 2007


Author: ivan
Date: Wed Nov 28 15:17:14 2007
New Revision: 17867

URL: http://svn.erp5.org?rev=17867&view=rev
Log:
Convert explicitly DateTime values to UTC.

Modified:
    erp5/trunk/products/ERP5Type/patches/sqlvar.py

Modified: erp5/trunk/products/ERP5Type/patches/sqlvar.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/sqlvar.py?rev=17867&r1=17866&r2=17867&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/sqlvar.py (original)
+++ erp5/trunk/products/ERP5Type/patches/sqlvar.py Wed Nov 28 15:17:14 2007
@@ -19,6 +19,7 @@
 from string import atoi,atof
 from types import StringType
 from Products.ERP5Type.PsycoWrapper import psyco
+from DateTime import DateTime
 
 def SQLVar_render(self, md):
     name=self.__name__
@@ -70,17 +71,15 @@
 
         try:
             if getattr(v, 'ISO', None) is not None:
-                v=v.ISO()
-            elif getattr(v, 'strftime', None) is not None:
-                v=v.strftime('%Y-%m-%d %H:%M:%S')
-            else: 
-                v=str(v)
+                v=v.toZone('UTC').ISO()
+            else:
+                v = DateTime(v)
+                v=v.toZone('UTC').ISO()
         except:
             if not v and args.has_key('optional') and args['optional']:
                 return 'null'
             raise ValueError, (
                 'Invalid datetime value for <em>%s</em>: %r' % (name, v))
-
         v=md.getitem('sql_quote__',0)(v)
     # End of patch
     else:




More information about the Erp5-report mailing list