Ticket #17899: 0001-Change-Ee-mail-in-Ee-mail-according-to-the-writing-c.patch
File 0001-Change-Ee-mail-in-Ee-mail-according-to-the-writing-c.patch, 31.1 KB (added by , 13 years ago) |
---|
-
django/conf/global_settings.py
From 8114d6530185b129374be72e9415c520d449348d Mon Sep 17 00:00:00 2001 From: Adrien Lemaire <lemaire.adrien@gmail.com> Date: Sat, 24 Mar 2012 12:42:18 +0900 Subject: [PATCH] Change [Ee]-mail in [Ee]mail according to the writing conventions. Result of : perl -e "s/-mail/mail/g;" -pi $(git grep -iIl "e-mail"|grep -v "django.po") --- django/conf/global_settings.py | 2 +- django/contrib/admin/forms.py | 4 +-- django/contrib/admin/templates/admin/500.html | 2 +- .../registration/password_reset_done.html | 2 +- .../registration/password_reset_email.html | 2 +- .../registration/password_reset_form.html | 4 +-- django/contrib/auth/forms.py | 6 ++--- .../auth/management/commands/createsuperuser.py | 6 ++--- django/contrib/auth/models.py | 2 +- django/contrib/auth/tests/forms.py | 2 +- .../registration/password_reset_done.html | 2 +- django/core/validators.py | 2 +- django/db/models/fields/__init__.py | 2 +- django/forms/fields.py | 2 +- docs/index.txt | 2 +- docs/internals/deprecation.txt | 2 +- docs/ref/forms/api.txt | 10 +++---- docs/ref/forms/fields.txt | 2 +- docs/ref/forms/validation.txt | 4 +-- docs/topics/testing.txt | 2 +- tests/modeltests/test_client/models.py | 4 +-- tests/regressiontests/admin_views/tests.py | 12 ++++----- tests/regressiontests/forms/tests/extra.py | 2 +- tests/regressiontests/forms/tests/fields.py | 28 ++++++++++---------- .../regressiontests/test_client_regress/models.py | 4 +-- tests/regressiontests/test_utils/tests.py | 2 +- 26 files changed, 57 insertions(+), 57 deletions(-) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index bd85c12..de125e7 100644
a b DEFAULT_CHARSET = 'utf-8' 144 144 # Encoding of files read from disk (template and initial SQL files). 145 145 FILE_CHARSET = 'utf-8' 146 146 147 # E -mail address that error messages come from.147 # Email address that error messages come from. 148 148 SERVER_EMAIL = 'root@localhost' 149 149 150 150 # Whether to send broken-link emails. -
django/contrib/admin/forms.py
diff --git a/django/contrib/admin/forms.py b/django/contrib/admin/forms.py index e790e2e..fac443b 100644
a b class AdminAuthenticationForm(AuthenticationForm): 26 26 self.user_cache = authenticate(username=username, password=password) 27 27 if self.user_cache is None: 28 28 if u'@' in username: 29 # Mistakenly entered e -mail address instead of username? Look it up.29 # Mistakenly entered email address instead of username? Look it up. 30 30 try: 31 31 user = User.objects.get(email=username) 32 32 except (User.DoesNotExist, User.MultipleObjectsReturned): … … class AdminAuthenticationForm(AuthenticationForm): 34 34 pass 35 35 else: 36 36 if user.check_password(password): 37 message = _("Your e -mail address is not your username."37 message = _("Your email address is not your username." 38 38 " Try '%s' instead.") % user.username 39 39 raise forms.ValidationError(message) 40 40 elif not self.user_cache.is_active or not self.user_cache.is_staff: -
django/contrib/admin/templates/admin/500.html
diff --git a/django/contrib/admin/templates/admin/500.html b/django/contrib/admin/templates/admin/500.html index eeb9e8d..7c35ab0 100644
a b 13 13 14 14 {% block content %} 15 15 <h1>{% trans 'Server Error <em>(500)</em>' %}</h1> 16 <p>{% trans "There's been an error. It's been reported to the site administrators via e -mail and should be fixed shortly. Thanks for your patience." %}</p>16 <p>{% trans "There's been an error. It's been reported to the site administrators via email and should be fixed shortly. Thanks for your patience." %}</p> 17 17 18 18 {% endblock %} -
django/contrib/admin/templates/registration/password_reset_done.html
diff --git a/django/contrib/admin/templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html index fd73af8..5988217 100644
a b 15 15 16 16 <h1>{% trans 'Password reset successful' %}</h1> 17 17 18 <p>{% trans "We've e -mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p>18 <p>{% trans "We've emailed you instructions for setting your password to the email address you submitted. You should be receiving it shortly." %}</p> 19 19 20 20 {% endblock %} -
django/contrib/admin/templates/registration/password_reset_email.html
diff --git a/django/contrib/admin/templates/registration/password_reset_email.html b/django/contrib/admin/templates/registration/password_reset_email.html index de9dc79..d2fa11c 100644
a b 1 1 {% load i18n %}{% load url from future %}{% autoescape off %} 2 {% blocktrans %}You're receiving this e -mail because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}2 {% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} 3 3 4 4 {% trans "Please go to the following page and choose a new password:" %} 5 5 {% block reset_link %} -
django/contrib/admin/templates/registration/password_reset_form.html
diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index 2b591fe..20f5357 100644
a b 15 15 16 16 <h1>{% trans "Password reset" %}</h1> 17 17 18 <p>{% trans "Forgotten your password? Enter your e -mail address below, and we'll e-mail instructions for setting a new one." %}</p>18 <p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p> 19 19 20 20 <form action="" method="post">{% csrf_token %} 21 21 {{ form.email.errors }} 22 <p><label for="id_email">{% trans 'E -mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p>22 <p><label for="id_email">{% trans 'Email address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p> 23 23 </form> 24 24 25 25 {% endblock %} -
django/contrib/auth/forms.py
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index a88c866..60596b6 100644
a b class AuthenticationForm(forms.Form): 184 184 185 185 class PasswordResetForm(forms.Form): 186 186 error_messages = { 187 'unknown': _("That e -mail address doesn't have an associated "187 'unknown': _("That email address doesn't have an associated " 188 188 "user account. Are you sure you've registered?"), 189 'unusable': _("The user account associated with this e -mail "189 'unusable': _("The user account associated with this email " 190 190 "address cannot reset the password."), 191 191 } 192 email = forms.EmailField(label=_("E -mail"), max_length=75)192 email = forms.EmailField(label=_("Email"), max_length=75) 193 193 194 194 def clean_email(self): 195 195 """ -
django/contrib/auth/management/commands/createsuperuser.py
diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py index ad65977..06e6d91 100644
a b EMAIL_RE = re.compile( 24 24 25 25 def is_valid_email(value): 26 26 if not EMAIL_RE.search(value): 27 raise exceptions.ValidationError(_('Enter a valid e -mail address.'))27 raise exceptions.ValidationError(_('Enter a valid email address.')) 28 28 29 29 30 30 class Command(BaseCommand): … … class Command(BaseCommand): 94 94 # Get an email 95 95 while 1: 96 96 if not email: 97 email = raw_input('E -mail address: ')97 email = raw_input('Email address: ') 98 98 try: 99 99 is_valid_email(email) 100 100 except exceptions.ValidationError: 101 sys.stderr.write("Error: That e -mail address is invalid.\n")101 sys.stderr.write("Error: That email address is invalid.\n") 102 102 email = None 103 103 else: 104 104 break -
django/contrib/auth/models.py
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 4e15849..4c8a1e7 100644
a b class User(models.Model): 234 234 '@/./+/-/_ characters')) 235 235 first_name = models.CharField(_('first name'), max_length=30, blank=True) 236 236 last_name = models.CharField(_('last name'), max_length=30, blank=True) 237 email = models.EmailField(_('e -mail address'), blank=True)237 email = models.EmailField(_('email address'), blank=True) 238 238 password = models.CharField(_('password'), max_length=128) 239 239 is_staff = models.BooleanField(_('staff status'), default=False, 240 240 help_text=_('Designates whether the user can log into this admin ' -
django/contrib/auth/tests/forms.py
diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py index 2bacc8e..119546a 100644
a b class PasswordResetFormTest(TestCase): 303 303 form = PasswordResetForm(data) 304 304 self.assertFalse(form.is_valid()) 305 305 self.assertEqual(form["email"].errors, 306 [u"The user account associated with this e -mail address cannot reset the password."])306 [u"The user account associated with this email address cannot reset the password."]) -
django/contrib/auth/tests/templates/registration/password_reset_done.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_done.html b/django/contrib/auth/tests/templates/registration/password_reset_done.html index d56b10f..c3d1d0c 100644
a b 1 E -mail sent2 No newline at end of file 1 Email sent 2 No newline at end of file -
django/core/validators.py
diff --git a/django/core/validators.py b/django/core/validators.py index 95224e9..bb50c6c 100644
a b email_re = re.compile( 162 162 r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' 163 163 r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)' # domain 164 164 r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', re.IGNORECASE) # literal form, ipv4 address (SMTP 4.1.3) 165 validate_email = EmailValidator(email_re, _(u'Enter a valid e -mail address.'), 'invalid')165 validate_email = EmailValidator(email_re, _(u'Enter a valid email address.'), 'invalid') 166 166 167 167 slug_re = re.compile(r'^[-\w]+$') 168 168 validate_slug = RegexValidator(slug_re, _(u"Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."), 'invalid') -
django/db/models/fields/__init__.py
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 22546c2..9cc958d 100644
a b class DecimalField(Field): 887 887 888 888 class EmailField(CharField): 889 889 default_validators = [validators.validate_email] 890 description = _("E -mail address")890 description = _("Email address") 891 891 892 892 def __init__(self, *args, **kwargs): 893 893 kwargs['max_length'] = kwargs.get('max_length', 75) -
django/forms/fields.py
diff --git a/django/forms/fields.py b/django/forms/fields.py index 96ecabf..0f5b0c5 100644
a b class RegexField(CharField): 471 471 472 472 class EmailField(CharField): 473 473 default_error_messages = { 474 'invalid': _(u'Enter a valid e -mail address.'),474 'invalid': _(u'Enter a valid email address.'), 475 475 } 476 476 default_validators = [validators.validate_email] 477 477 -
docs/index.txt
diff --git a/docs/index.txt b/docs/index.txt index a5d2e13..11ecc0d 100644
a b Other batteries included 174 174 * :doc:`Cross Site Request Forgery protection <ref/contrib/csrf>` 175 175 * :doc:`Cryptographic signing <topics/signing>` 176 176 * :doc:`Databrowse <ref/contrib/databrowse>` 177 * :doc:`E -mail (sending) <topics/email>`177 * :doc:`Email (sending) <topics/email>` 178 178 * :doc:`Flatpages <ref/contrib/flatpages>` 179 179 * :doc:`GeoDjango <ref/contrib/gis/index>` 180 180 * :doc:`Humanize <ref/contrib/humanize>` -
docs/internals/deprecation.txt
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 81ca7af..1b327c8 100644
a b these changes. 37 37 * The :mod:`django.contrib.gis.db.backend` module will be removed in favor 38 38 of the specific backends. 39 39 40 * ``SMTPConnection`` will be removed in favor of a generic E -mail backend API.40 * ``SMTPConnection`` will be removed in favor of a generic Email backend API. 41 41 42 42 * The many to many SQL generation functions on the database backends 43 43 will be removed. -
docs/ref/forms/api.txt
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 86b6bb4..b80714f 100644
a b Access the :attr:`~Form.errors` attribute to get a dictionary of error 105 105 messages:: 106 106 107 107 >>> f.errors 108 {'sender': [u'Enter a valid e -mail address.'], 'subject': [u'This field is required.']}108 {'sender': [u'Enter a valid email address.'], 'subject': [u'This field is required.']} 109 109 110 110 In this dictionary, the keys are the field names, and the values are lists of 111 111 Unicode strings representing the error messages. The error messages are stored … … method you're using:: 537 537 >>> print f.as_table() 538 538 <tr><th>Subject:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="subject" maxlength="100" /></td></tr> 539 539 <tr><th>Message:</th><td><input type="text" name="message" value="Hi there" /></td></tr> 540 <tr><th>Sender:</th><td><ul class="errorlist"><li>Enter a valid e -mail address.</li></ul><input type="text" name="sender" value="invalid email address" /></td></tr>540 <tr><th>Sender:</th><td><ul class="errorlist"><li>Enter a valid email address.</li></ul><input type="text" name="sender" value="invalid email address" /></td></tr> 541 541 <tr><th>Cc myself:</th><td><input checked="checked" type="checkbox" name="cc_myself" /></td></tr> 542 542 >>> print f.as_ul() 543 543 <li><ul class="errorlist"><li>This field is required.</li></ul>Subject: <input type="text" name="subject" maxlength="100" /></li> 544 544 <li>Message: <input type="text" name="message" value="Hi there" /></li> 545 <li><ul class="errorlist"><li>Enter a valid e -mail address.</li></ul>Sender: <input type="text" name="sender" value="invalid email address" /></li>545 <li><ul class="errorlist"><li>Enter a valid email address.</li></ul>Sender: <input type="text" name="sender" value="invalid email address" /></li> 546 546 <li>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></li> 547 547 >>> print f.as_p() 548 548 <p><ul class="errorlist"><li>This field is required.</li></ul></p> 549 549 <p>Subject: <input type="text" name="subject" maxlength="100" /></p> 550 550 <p>Message: <input type="text" name="message" value="Hi there" /></p> 551 <p><ul class="errorlist"><li>Enter a valid e -mail address.</li></ul></p>551 <p><ul class="errorlist"><li>Enter a valid email address.</li></ul></p> 552 552 <p>Sender: <input type="text" name="sender" value="invalid email address" /></p> 553 553 <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p> 554 554 … … pass that in at construction time:: 571 571 <div class="errorlist"><div class="error">This field is required.</div></div> 572 572 <p>Subject: <input type="text" name="subject" maxlength="100" /></p> 573 573 <p>Message: <input type="text" name="message" value="Hi there" /></p> 574 <div class="errorlist"><div class="error">Enter a valid e -mail address.</div></div>574 <div class="errorlist"><div class="error">Enter a valid email address.</div></div> 575 575 <p>Sender: <input type="text" name="sender" value="invalid email address" /></p> 576 576 <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p> 577 577 -
docs/ref/forms/fields.txt
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index fc8665b..c140d66 100644
a b exception or returns the clean value:: 30 30 >>> f.clean('invalid email address') 31 31 Traceback (most recent call last): 32 32 ... 33 ValidationError: [u'Enter a valid e -mail address.']33 ValidationError: [u'Enter a valid email address.'] 34 34 35 35 Core field arguments 36 36 -------------------- -
docs/ref/forms/validation.txt
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt index 42006bb..39884e1 100644
a b a look at Django's ``EmailField``:: 187 187 188 188 class EmailField(CharField): 189 189 default_error_messages = { 190 'invalid': _(u'Enter a valid e -mail address.'),190 'invalid': _(u'Enter a valid email address.'), 191 191 } 192 192 default_validators = [validators.validate_email] 193 193 … … on field definition so:: 200 200 is equivalent to:: 201 201 202 202 email = forms.CharField(validators=[validators.validate_email], 203 error_messages={'invalid': _(u'Enter a valid e -mail address.')})203 error_messages={'invalid': _(u'Enter a valid email address.')}) 204 204 205 205 206 206 Form field default cleaning -
docs/topics/testing.txt
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index 829e059..c9d87c0 100644
a b your test suite. 1549 1549 "a@a.com" as a valid email address, but rejects "aaa" with a reasonable 1550 1550 error message:: 1551 1551 1552 self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': [u'Enter a valid e -mail address.']})1552 self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': [u'Enter a valid email address.']}) 1553 1553 1554 1554 1555 1555 .. method:: TestCase.assertContains(response, text, count=None, status_code=200, msg_prefix='', html=False) -
tests/modeltests/test_client/models.py
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py index df872cd..f8faefb 100644
a b class ClientTest(TestCase): 214 214 self.assertEqual(response.status_code, 200) 215 215 self.assertTemplateUsed(response, "Invalid POST Template") 216 216 217 self.assertFormError(response, 'form', 'email', 'Enter a valid e -mail address.')217 self.assertFormError(response, 'form', 'email', 'Enter a valid email address.') 218 218 219 219 def test_valid_form_with_template(self): 220 220 "POST valid data to a form using multiple templates" … … class ClientTest(TestCase): 262 262 self.assertTemplateUsed(response, 'base.html') 263 263 self.assertTemplateNotUsed(response, "Invalid POST Template") 264 264 265 self.assertFormError(response, 'form', 'email', 'Enter a valid e -mail address.')265 self.assertFormError(response, 'form', 'email', 'Enter a valid email address.') 266 266 267 267 def test_unknown_page(self): 268 268 "GET an invalid URL" -
tests/regressiontests/admin_views/tests.py
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 12f1c67..c35f247 100644
a b class AdminViewPermissionsTest(TestCase): 864 864 self.assertFalse(login.context) 865 865 self.client.get('/test_admin/admin/logout/') 866 866 867 # Test if user enters e -mail address867 # Test if user enters email address 868 868 request = self.client.get('/test_admin/admin/') 869 869 self.assertEqual(request.status_code, 200) 870 870 login = self.client.post('/test_admin/admin/', self.super_email_login) 871 self.assertContains(login, "Your e -mail address is not your username")871 self.assertContains(login, "Your email address is not your username") 872 872 # only correct passwords get a username hint 873 873 login = self.client.post('/test_admin/admin/', self.super_email_bad_login) 874 874 self.assertContains(login, ERROR_MESSAGE) 875 875 new_user = User(username='jondoe', password='secret', email='super@example.com') 876 876 new_user.save() 877 # check to ensure if there are multiple e -mail addresses a user doesn't get a 500877 # check to ensure if there are multiple email addresses a user doesn't get a 500 878 878 login = self.client.post('/test_admin/admin/', self.super_email_login) 879 879 self.assertContains(login, ERROR_MESSAGE) 880 880 … … class SecureViewTests(TestCase): 1494 1494 # make sure the view removes test cookie 1495 1495 self.assertEqual(self.client.session.test_cookie_worked(), False) 1496 1496 1497 # Test if user enters e -mail address1497 # Test if user enters email address 1498 1498 request = self.client.get('/test_admin/admin/secure-view/') 1499 1499 self.assertEqual(request.status_code, 200) 1500 1500 login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login) 1501 self.assertContains(login, "Your e -mail address is not your username")1501 self.assertContains(login, "Your email address is not your username") 1502 1502 # only correct passwords get a username hint 1503 1503 login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login) 1504 1504 self.assertContains(login, ERROR_MESSAGE) 1505 1505 new_user = User(username='jondoe', password='secret', email='super@example.com') 1506 1506 new_user.save() 1507 # check to ensure if there are multiple e -mail addresses a user doesn't get a 5001507 # check to ensure if there are multiple email addresses a user doesn't get a 500 1508 1508 login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login) 1509 1509 self.assertContains(login, ERROR_MESSAGE) 1510 1510 -
tests/regressiontests/forms/tests/extra.py
diff --git a/tests/regressiontests/forms/tests/extra.py b/tests/regressiontests/forms/tests/extra.py index c873af7..b89895f 100644
a b class FormsExtraTestCase(TestCase, AssertFormErrorsMixin): 602 602 data = dict(email='invalid') 603 603 f = CommentForm(data, auto_id=False, error_class=DivErrorList) 604 604 self.assertHTMLEqual(f.as_p(), """<p>Name: <input type="text" name="name" maxlength="50" /></p> 605 <div class="errorlist"><div class="error">Enter a valid e -mail address.</div></div>605 <div class="errorlist"><div class="error">Enter a valid email address.</div></div> 606 606 <p>Email: <input type="text" name="email" value="invalid" /></p> 607 607 <div class="errorlist"><div class="error">This field is required.</div></div> 608 608 <p>Comment: <input type="text" name="comment" /></p>""") -
tests/regressiontests/forms/tests/fields.py
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py index 03e0ff6..58e0c2f 100644
a b class FieldsTests(SimpleTestCase): 527 527 self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, '') 528 528 self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, None) 529 529 self.assertEqual(u'person@example.com', f.clean('person@example.com')) 530 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo')531 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo@')532 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo@bar')533 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'example@invalid-.com')534 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'example@-invalid.com')535 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'example@inv-.alid-.com')536 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'example@inv-.-alid.com')530 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo') 531 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo@') 532 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo@bar') 533 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'example@invalid-.com') 534 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'example@-invalid.com') 535 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'example@inv-.alid-.com') 536 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'example@inv-.-alid.com') 537 537 self.assertEqual(u'example@valid-----hyphens.com', f.clean('example@valid-----hyphens.com')) 538 538 self.assertEqual(u'example@valid-with-hyphens.com', f.clean('example@valid-with-hyphens.com')) 539 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'example@.com')539 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'example@.com') 540 540 self.assertEqual(u'local@domain.with.idn.xyz\xe4\xf6\xfc\xdfabc.part.com', f.clean('local@domain.with.idn.xyzäöüßabc.part.com')) 541 541 542 542 def test_email_regexp_for_performance(self): … … class FieldsTests(SimpleTestCase): 545 545 # if the security fix isn't in place. 546 546 self.assertRaisesMessage( 547 547 ValidationError, 548 "[u'Enter a valid e -mail address.']",548 "[u'Enter a valid email address.']", 549 549 f.clean, 550 550 'viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058' 551 551 ) … … class FieldsTests(SimpleTestCase): 556 556 self.assertEqual(u'', f.clean(None)) 557 557 self.assertEqual(u'person@example.com', f.clean('person@example.com')) 558 558 self.assertEqual(u'example@example.com', f.clean(' example@example.com \t \t ')) 559 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo')560 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo@')561 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'foo@bar')559 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo') 560 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo@') 561 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'foo@bar') 562 562 563 563 def test_emailfield_3(self): 564 564 f = EmailField(min_length=10, max_length=15) … … class FieldsTests(SimpleTestCase): 967 967 f = ComboField(fields=[CharField(max_length=20), EmailField()]) 968 968 self.assertEqual(u'test@example.com', f.clean('test@example.com')) 969 969 self.assertRaisesMessage(ValidationError, "[u'Ensure this value has at most 20 characters (it has 28).']", f.clean, 'longemailaddress@example.com') 970 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'not an e-mail')970 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'not an email') 971 971 self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, '') 972 972 self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, None) 973 973 … … class FieldsTests(SimpleTestCase): 975 975 f = ComboField(fields=[CharField(max_length=20), EmailField()], required=False) 976 976 self.assertEqual(u'test@example.com', f.clean('test@example.com')) 977 977 self.assertRaisesMessage(ValidationError, "[u'Ensure this value has at most 20 characters (it has 28).']", f.clean, 'longemailaddress@example.com') 978 self.assertRaisesMessage(ValidationError, "[u'Enter a valid e -mail address.']", f.clean, 'not an e-mail')978 self.assertRaisesMessage(ValidationError, "[u'Enter a valid email address.']", f.clean, 'not an email') 979 979 self.assertEqual(u'', f.clean('')) 980 980 self.assertEqual(u'', f.clean(None)) 981 981 -
tests/regressiontests/test_client_regress/models.py
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index 0f98b2c..dc01dc7 100644
a b class AssertFormErrorTests(TestCase): 492 492 try: 493 493 self.assertFormError(response, 'form', 'email', 'Some error.') 494 494 except AssertionError, e: 495 self.assertIn("The field 'email' on form 'form' in context 0 does not contain the error 'Some error.' (actual errors: [u'Enter a valid e -mail address.'])", str(e))495 self.assertIn("The field 'email' on form 'form' in context 0 does not contain the error 'Some error.' (actual errors: [u'Enter a valid email address.'])", str(e)) 496 496 try: 497 497 self.assertFormError(response, 'form', 'email', 'Some error.', msg_prefix='abc') 498 498 except AssertionError, e: 499 self.assertIn("abc: The field 'email' on form 'form' in context 0 does not contain the error 'Some error.' (actual errors: [u'Enter a valid e -mail address.'])", str(e))499 self.assertIn("abc: The field 'email' on form 'form' in context 0 does not contain the error 'Some error.' (actual errors: [u'Enter a valid email address.'])", str(e)) 500 500 501 501 def test_unknown_nonfield_error(self): 502 502 """ -
tests/regressiontests/test_utils/tests.py
diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py index 7f4208c..cef5fd7 100644
a b class AssertRaisesMsgTest(SimpleTestCase): 477 477 class AssertFieldOutputTests(SimpleTestCase): 478 478 479 479 def test_assert_field_output(self): 480 error_invalid = [u'Enter a valid e -mail address.']480 error_invalid = [u'Enter a valid email address.'] 481 481 self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid}) 482 482 self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid + [u'Another error']}) 483 483 self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid})