Commit 119d2003 authored by Jérome Perrin's avatar Jérome Perrin

catch zope 2.7 Date exceptions (DateError, TimeError) in DateTime validator


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4264 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a5edcb8
...@@ -647,6 +647,7 @@ class PatchedDateTimeWidget(DateTimeWidget): ...@@ -647,6 +647,7 @@ class PatchedDateTimeWidget(DateTimeWidget):
DateTimeField.widget = PatchedDateTimeWidget() DateTimeField.widget = PatchedDateTimeWidget()
from Products.Formulator.Validator import DateTimeValidator, ValidationError, DateTime from Products.Formulator.Validator import DateTimeValidator, ValidationError, DateTime
from DateTime.DateTime import DateError, TimeError
class PatchedDateTimeValidator(DateTimeValidator): class PatchedDateTimeValidator(DateTimeValidator):
""" """
...@@ -709,8 +710,9 @@ class PatchedDateTimeValidator(DateTimeValidator): ...@@ -709,8 +710,9 @@ class PatchedDateTimeValidator(DateTimeValidator):
try: try:
result = DateTime(int(year), int(month), int(day), hour, minute) result = DateTime(int(year), int(month), int(day), hour, minute)
# ugh, a host of string based exceptions # ugh, a host of string based exceptions (not since Zope 2.7)
except ('DateTimeError', 'Invalid Date Components', 'TimeError'): except ('DateTimeError', 'Invalid Date Components', 'TimeError',
DateError, TimeError) :
self.raise_error('not_datetime', field) self.raise_error('not_datetime', field)
# check if things are within range # check if things are within range
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment