Django

Code

Ticket #2611 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

XML serialization does not handle null datetime fields

Reported by: csdurfee@gmail.com Assigned to: adrian
Milestone: Component: Database layer (models, ORM)
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by adrian)

If you try to serialize a Django object to XML (JSON serialization is fine) that has a null datetime field, you get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\python24\lib\site-packages\django\core\serializers\__init__.py", line
 55, in serialize
    s.serialize(queryset, **options)
  File "c:\python24\lib\site-packages\django\core\serializers\base.py", line 39,
 in serialize
    self.handle_field(obj, field)
  File "c:\python24\lib\site-packages\django\core\serializers\xml_serializer.py"
, line 61, in handle_field
    value = self.get_string_value(obj, field)
  File "c:\python24\lib\site-packages\django\core\serializers\base.py", line 53,
 in get_string_value
    value = getattr(obj, field.name).strftime("%Y-%m-%d %H:%M:%S")

Attachments

Change History

08/30/06 23:08:53 changed by adrian

  • description changed.

08/30/06 23:11:46 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [3687]) Fixed #2611 -- Fixed XML serializer to handle null datetime fields. Thanks for reporting, csdurfee@gmail.com


Add/Change #2611 (XML serialization does not handle null datetime fields)




Change Properties
Action