From c58e5724bcebc74ccfbc49a4a29de6fd0fa6103e Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Thu, 13 Oct 2011 11:53:59 +0000 Subject: Fixed a couple of `assert` syntax warnings mistakingly introduced in r16966 and added some tests to prevent future regressions. Thanks to Anssi Kääriäinen for the report. Refs #12467. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@16971 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/fields/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'django') diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 7e119c2f86..67acbbae76 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -510,8 +510,8 @@ class AutoField(Field): 'invalid': _(u"'%s' value must be an integer."), } def __init__(self, *args, **kwargs): - assert (kwargs.get('primary_key', False) is True, - "%ss must have primary_key=True." % self.__class__.__name__) + assert kwargs.get('primary_key', False) is True, \ + "%ss must have primary_key=True." % self.__class__.__name__ kwargs['blank'] = True Field.__init__(self, *args, **kwargs) @@ -536,8 +536,8 @@ class AutoField(Field): return int(value) def contribute_to_class(self, cls, name): - assert (not cls._meta.has_auto_field, - "A model can't have more than one AutoField.") + assert not cls._meta.has_auto_field, \ + "A model can't have more than one AutoField." super(AutoField, self).contribute_to_class(cls, name) cls._meta.has_auto_field = True cls._meta.auto_field = self -- cgit v1.3