Opened 18 years ago
Closed 18 years ago
#2894 closed defect (fixed)
[patch] XML Deserializer does not handle None values in Foreign Keys
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Although the XML Serializer handle_fk_field method goes out of its way to create a 'None' element if the foreign key relation is None, the Deserializer fails to handle the case.
Example: In a Model with a self-referential Foreign key which is allowed to be blank (and null), you may have entries with a blank value. This gets mapped to the 'None' element over the wire and results in an exception when the system attempts to find the related key with primary key , since the None element contains no text.
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | deserialize_none_fk.diff added |
---|
comment:1 by , 18 years ago
Summary: | XML Deserializer does not handle None values in Foreign Keys → [patch] XML Deserializer does not handle None values in Foreign Keys |
---|
A simple patch to detect the None element. It is not exceedingly paranoid about the XML structure, but the test should be resilient to badness (crash-wise) since it only subscripts if there is exactly one child and any child/node is guaranteed to have a nodeName, even if it turns out to be an attribute or something weird.
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Simple patch to handle None case.