mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #4558 -- Modified XML serializer to handle whitespace better around None tags. Thanks to Bill Fenner <fenner@gmail.com> for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5727 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
11
tests/regressiontests/fixtures_regress/fixtures/pretty.xml
Normal file
11
tests/regressiontests/fixtures_regress/fixtures/pretty.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<django-objects version="1.0">
|
||||
<object pk="1" model="fixtures_regress.stuff">
|
||||
<field type="CharField" name="name">
|
||||
<None/>
|
||||
</field>
|
||||
<field to="auth.user" name="owner" rel="ManyToOneRel">
|
||||
<None/>
|
||||
</field>
|
||||
</object>
|
||||
</django-objects>
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
class Animal(models.Model):
|
||||
name = models.CharField(maxlength=150)
|
||||
@@ -14,6 +15,13 @@ class Plant(models.Model):
|
||||
# For testing when upper case letter in app name; regression for #4057
|
||||
db_table = "Fixtures_regress_plant"
|
||||
|
||||
class Stuff(models.Model):
|
||||
name = models.CharField(maxlength=20, null=True)
|
||||
owner = models.ForeignKey(User, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.name) + u' is owned by ' + unicode(self.owner)
|
||||
|
||||
__test__ = {'API_TESTS':"""
|
||||
>>> from django.core import management
|
||||
|
||||
@@ -26,4 +34,13 @@ __test__ = {'API_TESTS':"""
|
||||
>>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus')
|
||||
>>> animal.save()
|
||||
|
||||
###############################################
|
||||
# Regression test for ticket #4558 -- pretty printing of XML fixtures
|
||||
# doesn't affect parsing of None values.
|
||||
|
||||
# Load a pretty-printed XML fixture with Nulls.
|
||||
>>> management.load_data(['pretty.xml'], verbosity=0)
|
||||
>>> Stuff.objects.all()
|
||||
[<Stuff: None is owned by None>]
|
||||
|
||||
"""}
|
||||
|
||||
Reference in New Issue
Block a user