r13745 - in Products.Archetypes/trunk: . Products/Archetypes

"Ross Patterson" <[email protected]> Mon, 01 Aug 2011 00:56:23 +0000
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: rossp
Date: Mon Aug  1 00:56:23 2011
New Revision: 13745

Modified:
   Products.Archetypes/trunk/CHANGES.txt
   Products.Archetypes/trunk/Products/Archetypes/Field.py
Log:
Do a double DateTime conversion to avoid timezone naive values. fixes #10141

Modified: Products.Archetypes/trunk/CHANGES.txt
==============================================================================
--- Products.Archetypes/trunk/CHANGES.txt	(original)
+++ Products.Archetypes/trunk/CHANGES.txt	Mon Aug  1 00:56:23 2011
@@ -4,6 +4,10 @@
 1.7.7 - Unreleased
 ------------------
 
+- Do a double DateTime conversion to avoid timezone naive values.
+  Refs http://dev.plone.org/plone/ticket/10141.
+  [rossp]
+
 - Avoid site error when we display a file whose mimetype is unknown.
   Refs http://dev.plone.org/plone/ticket/12061.
   [thomasdesvenain]

Modified: Products.Archetypes/trunk/Products/Archetypes/Field.py
==============================================================================
--- Products.Archetypes/trunk/Products/Archetypes/Field.py	(original)
+++ Products.Archetypes/trunk/Products/Archetypes/Field.py	Mon Aug  1 00:56:23 2011
@@ -1463,6 +1463,10 @@
                 # otherwise it uses timezone naive conversion.
                 # see http://dev.plone.org/plone/ticket/10141
                 value = DateTime(value.replace('-', '/', 2))
+                if value.timezoneNaive():
+                    # Do a double conversion to accept the local
+                    # timezone assumption as non-naive
+                    value = DateTime(value)
             except DateTimeError:
                 value = None
 

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey