Django

Code

Ticket #2650 (closed: invalid)

Opened 2 years ago

Last modified 1 year ago

XML Serialization of None TextFields does not use the <None/> tag

Reported by: ben.khoo@calytrix.com Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

There appears to be a problem serializing TextFields? where the value is None.

Refer to line 62 of xml_serializer.py The expected return value from self.get_string_value(obj, field) is either a string or None however the get_string_value method does not appear to return None when appropriate.

The result of this oversight is that TextFields? where the value is None is encoded as

<field type="TextField" name="comment">None</field>

rather than

<field type="TextField" name="comment">
<None/>
</field>

Attachments

base.py (4.7 kB) - added by ben.khoo@calytrix.com on 09/03/06 21:42:22.
A potential patch
xml_serializer.py (8.0 kB) - added by ben.khoo@calytrix.com on 09/03/06 21:47:47.
Modification to the XML serializer to correctly encode the tag

Change History

09/03/06 21:42:22 changed by ben.khoo@calytrix.com

  • attachment base.py added.

A potential patch

09/03/06 21:43:43 changed by anonymous

  • summary changed from XML Serialization of None TextFields does not use the <None/> tag to [patch] XML Serialization of None TextFields does not use the <None/> tag.

09/03/06 21:47:47 changed by ben.khoo@calytrix.com

  • attachment xml_serializer.py added.

Modification to the XML serializer to correctly encode the tag

09/21/06 21:18:56 changed by mtredinnick

  • summary changed from [patch] XML Serialization of None TextFields does not use the <None/> tag to XML Serialization of None TextFields does not use the <None/> tag.

Please attach a patch against the current source, rather than the whole files. It is very difficult to work out what places you made changes to in both these files.

From what I can work out from your changes, I'm not sure it is correct. Can you please attach a test case showing that we deserialize the object correctly after making the change you propose. There might be a change needed in deserialization as well.

Removing the patch keyword for now until there is a real patch available.

01/30/07 03:22:35 changed by Simon G. <dev@simon.net.nz>

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

Add/Change #2650 (XML Serialization of None TextFields does not use the <None/> tag)




Change Properties
Action