XML deserializer strips leading whitespace on loaddata
|Reported by:||Owned by:||Martin Matusiak|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If an object instance has a character field and the value of that field starts with the tab character, loaddata removes that tab character when the loaded fixture is in XML format.
Note that the XML dump data does not strip this leading tab character. Also note that both the JSON dump and load data preserve the tab character.
I have not tested this with other whitespace characters. This can be easily reproduced by creating a simple model:
class Foobar(models.model) name = models.CharField(max_length=20)
And then creating an instance of that model (e.g, in Django Shell) with a name value of, e.g,
"\tBaz" and then using the manage.py dumpdata with
Once the fixture has been generated, remove the existing instance (either by deleting it, or flushing the app data, or your preferred method) and then using manage.py loaddata to load the fixture. Note the instance's name no longer contains the tab character.
Change History (8)
comment:1 Changed 3 years ago by
|Owner:||changed from nobody to Martin Matusiak|
|Patch needs improvement:||unset|
|Status:||new → assigned|
comment:5 Changed 3 years ago by
|Triage Stage:||Unreviewed → Accepted|