Hi,
I seek advice if the following behavior is a bug or a feature:
xml_serialize.py generates a blank-space-free XML file, for example :
"""<field to="app.somemodel" name="somefield"
rel="ManyToOneRel"><None></None></field>"""
If I pretty-print (introducing '\n') that XML file, for example into:
"""
<field to="app.somemodel" name="somefield" rel="ManyToOneRel">
<None>
</None>
</field>
"""
Then it breaks deserialization badly, because in xml_serializer.py->
method _handle_fk_field_node there is the test:
if len(node.childNodes) == 1 and node.childNodes[0].nodeName == 'None':
return None
If pretty-printing occurs, childNodes is [DomNode '\n', DomNode None, DomNode
'\n'],
instead of [DomNode None], and then it breaks.
The problem __only manifests for None values__ in pretty-printed XML files.
So, what is the right conclusion:
(1) It was an accident that pretty-printed XML serialized files actually work.
The xml-serialized file should not be tempered and deserialized as it was
produced.
(2) Serialized pretty-printed xml files should work, and the None handling is a
bug.
If (1) is right, perhaps we should add a note to [1].
If (2) is right, should we open a ticket ? I could do it, but I do not have a
login
in the tracker.
[1] http://www.djangoproject.com/documentation/serialization/
best regards,
Rod Senra
--
http://rodrigo.senra.nom.br
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---