Skip to content

Commit

Permalink
Allow None values on Datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored and markpasc committed Feb 11, 2010
1 parent cba5699 commit dc3f868
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions remoteobjects/fields.py
Expand Up @@ -375,6 +375,10 @@ def decode(self, value):
The resulting `datetime` will have no time zone.
"""
if value is None:
if callable(self.default):
return self.default()
return self.default
try:
return datetime(*(time.strptime(value, self.dateformat))[0:6])
except (TypeError, ValueError):
Expand Down

0 comments on commit dc3f868

Please sign in to comment.