From 682e435c5f334bc0211b12f05398fe79e4e72713 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 27 Nov 2006 01:55:24 +0000 Subject: newforms: Changed Form.errors to be a property rather than a function. Refs #3026 git-svn-id: http://code.djangoproject.com/svn/django/trunk@4116 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/tests.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index e588b6572b..3d7543badd 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -1163,13 +1163,13 @@ u''
  • Birthday:
  • >>> p = Person({'first_name': u'John', 'last_name': u'Lennon', 'birthday': u'1940-10-9'}) ->>> p.errors() +>>> p.errors {} >>> p.is_valid() True ->>> p.errors().as_ul() +>>> p.errors.as_ul() u'' ->>> p.errors().as_text() +>>> p.errors.as_text() u'' >>> p.clean() {'first_name': u'John', 'last_name': u'Lennon', 'birthday': datetime.date(1940, 10, 9)} @@ -1197,13 +1197,13 @@ u'First name:First name: \n
  • Last name:
  • \n
  • Birthday:
  • ' >>> p = Person({'last_name': u'Lennon'}) ->>> p.errors() +>>> p.errors {'first_name': [u'This field is required.'], 'birthday': [u'This field is required.']} >>> p.is_valid() False ->>> p.errors().as_ul() +>>> p.errors.as_ul() u'' ->>> print p.errors().as_text() +>>> print p.errors.as_text() * first_name * This field is required. * birthday @@ -1385,13 +1385,13 @@ Field.clean(), the clean_XXX() method should return the cleaned value: ... raise ValidationError(u'Please make sure your passwords match.') ... return self.clean_data['password2'] >>> f = UserRegistration() ->>> f.errors() +>>> f.errors {'username': [u'This field is required.'], 'password1': [u'This field is required.'], 'password2': [u'This field is required.']} >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'bar'}) ->>> f.errors() +>>> f.errors {'password2': [u'Please make sure your passwords match.']} >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'foo'}) ->>> f.errors() +>>> f.errors {} >>> f.clean() {'username': u'adrian', 'password1': u'foo', 'password2': u'foo'} @@ -1414,10 +1414,10 @@ Form.clean() still needs to return a dictionary of all clean data: Username: Password1: Password2: ->>> f.errors() +>>> f.errors {'username': [u'This field is required.'], 'password1': [u'This field is required.'], 'password2': [u'This field is required.']} >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'bar'}) ->>> f.errors() +>>> f.errors {'__all__': [u'Please make sure your passwords match.']} >>> print f.as_table() Username: @@ -1434,7 +1434,7 @@ Form.clean() still needs to return a dictionary of all clean data:
  • Password1:
  • Password2:
  • >>> f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'foo'}) ->>> f.errors() +>>> f.errors {} >>> f.clean() {'username': u'adrian', 'password1': u'foo', 'password2': u'foo'} -- cgit v1.3