Made the fixtures_regress test case be aware of Oracle's empty string

limitations.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ian Kelly 2007-09-15 00:08:08 +00:00
parent 8c5214d9b4
commit ad821b6459
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
class Animal(models.Model):
name = models.CharField(max_length=150)
@ -20,7 +21,12 @@ class Stuff(models.Model):
owner = models.ForeignKey(User, null=True)
def __unicode__(self):
return unicode(self.name) + u' is owned by ' + unicode(self.owner)
# Oracle doesn't distinguish between None and the empty string.
# This hack makes the test case pass using Oracle.
name = self.name
if settings.DATABASE_ENGINE == 'oracle' and name == u'':
name = None
return unicode(name) + u' is owned by ' + unicode(self.owner)
__test__ = {'API_TESTS':"""
>>> from django.core import management