datetime widget: accept empty time field

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3577 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-10-12 15:16:19 +00:00
parent a9cf186875
commit 247de809fa

View file

@ -232,6 +232,8 @@ class DateFieldInstance(NumberFieldInstance):
def unmarshall(self, value):
if not value:
return None
if len(value) > 1 and value[0] and not value[1]:
value[1] = 'T00:00:00'
value = ''.join(value)
if value:
return datetime(*(strptime(value, '%Y-%m-%dT%H:%M:%S')[:6]))