Bug #178
JSONAttribute exception with DateField and DateTimeField and None values
100%
Description
In philo.models.fields.entities.JSONAttribute.value_from_object
, in the case where self.field_template
is either models.DateField
or models.DateTimeField
and the value is a SimpleLazyObject
wrapping None
, calling self.field_template.to_python(value)
raises an exception since DateField.to_python
and DateTimeField.to_python
do an is None
check, which will never return true with the SimpleLazyObject
passed in, and then goes on to use smart_str
to coerce the value (None
) to a string ('None'
), which cannot be parsed as a date.
Associated revisions
Merge branch 'release/0.9.2'
- release/0.9.2:
Bumped version number and wrote release notes for 0.9.2 in preparation for release.
Fixed an exception with JSONAttributes using DateField or DateTimeField as their field template when the stored value is None. Fixes #178.
Updated copyright date range to end in 2012 instead of 2011.
Added include_package_data option to setup.py to ensure MANIFEST.in is actually heeded.
Merge branch 'develop' into gilbert-ext4
- develop:
Fixed a few bugs with the documentation, and links to the documentation from the README. Sphinx can now build the documentation reliably due to conf.py explicitly adding the docs directory to the path. Added a link to the Bitbucket mirror, extending the set currently consisting of GitHub and Gitorious.
Bumped version number and wrote release notes for 0.9.2 in preparation for release.
Fixed an exception with JSONAttributes using DateField or DateTimeField as their field template when the stored value is None. Fixes #178.
Updated copyright date range to end in 2012 instead of 2011.
History
Updated by Joseph Spiros about 12 years ago
- Status changed from New to In Progress
The solution I'm implementing is to simply return None
in philo.models.fields.entities.JSONAttribute.value_from_object
if any ValidationError
exceptions are raised by DateField.to_python
and DateTimeField.to_python
. In addition to handling the None
case, this should also help in situations where the underlying stored JSON value is in any unparseable format.
Updated by Joseph Spiros about 12 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset b639b27fcefa205df835662bec0909e3f0d81b99.
Fixed an exception with JSONAttributes using DateField or DateTimeField as their field template when the stored value is None. Fixes #178.