[Erp5-dev] [Erp5-report] r17867 - /erp5/trunk/products/ERP5Type/patches/sqlvar.py
bartek
bartek at erp5.pl
Wed Jan 2 15:09:24 CET 2008
Hi
I have a problem with this change - when it is applied, activities are
not executed. On the HEAD version with this one reverted everything
works fine. From what I found out, it is because the value of "now"
supplied by activity tool to sql methods is being converted to UTC,
which means 1 hour is subtracted (my machine is set to GMT+1), in effect
the activity tool executes only messages which are older then one hour :)
Has this patch been tested on a machine using timezone other then GMT?
Bartek
nobody at svn.erp5.org wrote:
> 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:
>
> _______________________________________________
> Erp5-report mailing list
> Erp5-report at erp5.org
> http://mail.nexedi.com/mailman/listinfo/erp5-report
>
--
"feelings affect productivity. (...) unhappy people write worse
software, and less of it."
Karl Fogel, "Producing Open Source Software"
More information about the Erp5-dev
mailing list