workaround a dateutil bug

In the latest released version of dateutil, there's a bug whereby a TypeError
can be raised whilst parsing a date. This is because it calls a method which
it expects to return 2 arguments, however it can return 1 depending upon the
input, which results in a TypeError: ArgType not iterable exception. Since
this is equivalent to a failed parse anyway, we can treat it the same as a
ValueError.
This commit is contained in:
Damien Churchill 2014-03-12 17:19:49 +00:00
parent d4b3649640
commit d27a1103fa

View File

@ -391,7 +391,7 @@ class DateTimeField(BaseField):
if dateutil: if dateutil:
try: try:
return dateutil.parser.parse(value) return dateutil.parser.parse(value)
except ValueError: except (TypeError, ValueError):
return None return None
# split usecs, because they are not recognized by strptime. # split usecs, because they are not recognized by strptime.