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

"Hanno Schlichting" <[email protected]> Sun, 08 May 2011 15:16:47 +0000
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: hannosch
Date: Sun May  8 15:16:47 2011
New Revision: 13618

Modified:
   Products.Archetypes/trunk/CHANGES.txt
   Products.Archetypes/trunk/Products/Archetypes/Field.py
Log:
Add forward compatibility with DateTime 3.


Modified: Products.Archetypes/trunk/CHANGES.txt
==============================================================================
--- Products.Archetypes/trunk/CHANGES.txt	(original)
+++ Products.Archetypes/trunk/CHANGES.txt	Sun May  8 15:16:47 2011
@@ -4,6 +4,9 @@
 1.7.5 - unreleased
 ------------------
 
+- Add forward compatibility with DateTime 3.
+  [hannosch]
+
 - Avoid flagging base units as changed, if their values didn't actually change.
   [hannosch]
 

Modified: Products.Archetypes/trunk/Products/Archetypes/Field.py
==============================================================================
--- Products.Archetypes/trunk/Products/Archetypes/Field.py	(original)
+++ Products.Archetypes/trunk/Products/Archetypes/Field.py	Sun May  8 15:16:47 2011
@@ -19,6 +19,7 @@
 from Acquisition import aq_inner
 from ComputedAttribute import ComputedAttribute
 from DateTime import DateTime
+from DateTime.interfaces import DateTimeError
 from ExtensionClass import Base
 from OFS.Image import File
 from OFS.Image import Pdata
@@ -1437,7 +1438,7 @@
     def validate_required(self, instance, value, errors):
         try:
             DateTime(value)
-        except DateTime.DateTimeError:
+        except DateTimeError:
             result = False
         else:
             # None is a valid DateTime input, but does not validate for
@@ -1462,7 +1463,7 @@
                 # otherwise it uses timezone naive conversion.
                 # see http://dev.plone.org/plone/ticket/10141
                 value = DateTime(value.replace('-', '/', 2))
-            except DateTime.DateTimeError:
+            except DateTimeError:
                 value = None
 
         ObjectField.set(self, instance, value, **kwargs)

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd