Project

General

Profile

Bug #178

JSONAttribute exception with DateField and DateTimeField and None values

Added by Joseph Spiros about 12 years ago. Updated about 12 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
Core
Target version:
Start date:
01/31/2012
Due date:
% Done:

100%

Estimated time:

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

Revision b639b27f (diff)
Added by Joseph Spiros about 12 years ago

Fixed an exception with JSONAttributes using DateField or DateTimeField as their field template when the stored value is None. Fixes #178.

Revision 8a772dd4
Added by Joseph Spiros about 12 years ago

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.

Revision 5c919ea0
Added by Joseph Spiros about 12 years ago

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

#1

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.

#2

Updated by Joseph Spiros about 12 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF