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 Adrien Lemaire, 12 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'  
    144144# Encoding of files read from disk (template and initial SQL files).
    145145FILE_CHARSET = 'utf-8'
    146146
    147 # E-mail address that error messages come from.
     147# Email address that error messages come from.
    148148SERVER_EMAIL = 'root@localhost'
    149149
    150150# 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):  
    2626            self.user_cache = authenticate(username=username, password=password)
    2727            if self.user_cache is None:
    2828                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.
    3030                    try:
    3131                        user = User.objects.get(email=username)
    3232                    except (User.DoesNotExist, User.MultipleObjectsReturned):
    class AdminAuthenticationForm(AuthenticationForm):  
    3434                        pass
    3535                    else:
    3636                        if user.check_password(password):
    37                             message = _("Your e-mail address is not your username."
     37                            message = _("Your email address is not your username."
    3838                                        " Try '%s' instead.") % user.username
    3939                raise forms.ValidationError(message)
    4040            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  
    1313
    1414{% block content %}
    1515<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>
    1717
    1818{% 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  
    1515
    1616<h1>{% trans 'Password reset successful' %}</h1>
    1717
    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>
    1919
    2020{% 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  
    11{% 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 %}
    33
    44{% trans "Please go to the following page and choose a new password:" %}
    55{% 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  
    1515
    1616<h1>{% trans "Password reset" %}</h1>
    1717
    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>
    1919
    2020<form action="" method="post">{% csrf_token %}
    2121{{ 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>
    2323</form>
    2424
    2525{% 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):  
    184184
    185185class PasswordResetForm(forms.Form):
    186186    error_messages = {
    187         'unknown': _("That e-mail address doesn't have an associated "
     187        'unknown': _("That email address doesn't have an associated "
    188188                     "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 "
    190190                      "address cannot reset the password."),
    191191    }
    192     email = forms.EmailField(label=_("E-mail"), max_length=75)
     192    email = forms.EmailField(label=_("Email"), max_length=75)
    193193
    194194    def clean_email(self):
    195195        """
  • 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(  
    2424
    2525def is_valid_email(value):
    2626    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.'))
    2828
    2929
    3030class Command(BaseCommand):
    class Command(BaseCommand):  
    9494                # Get an email
    9595                while 1:
    9696                    if not email:
    97                         email = raw_input('E-mail address: ')
     97                        email = raw_input('Email address: ')
    9898                    try:
    9999                        is_valid_email(email)
    100100                    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")
    102102                        email = None
    103103                    else:
    104104                        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):  
    234234                    '@/./+/-/_ characters'))
    235235    first_name = models.CharField(_('first name'), max_length=30, blank=True)
    236236    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)
    238238    password = models.CharField(_('password'), max_length=128)
    239239    is_staff = models.BooleanField(_('staff status'), default=False,
    240240        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):  
    303303        form = PasswordResetForm(data)
    304304        self.assertFalse(form.is_valid())
    305305        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 sent
    2  No newline at end of file
     1Email 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(  
    162162    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"'
    163163    r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)'  # domain
    164164    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')
     165validate_email = EmailValidator(email_re, _(u'Enter a valid email address.'), 'invalid')
    166166
    167167slug_re = re.compile(r'^[-\w]+$')
    168168validate_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):  
    887887
    888888class EmailField(CharField):
    889889    default_validators = [validators.validate_email]
    890     description = _("E-mail address")
     890    description = _("Email address")
    891891
    892892    def __init__(self, *args, **kwargs):
    893893        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):  
    471471
    472472class EmailField(CharField):
    473473    default_error_messages = {
    474         'invalid': _(u'Enter a valid e-mail address.'),
     474        'invalid': _(u'Enter a valid email address.'),
    475475    }
    476476    default_validators = [validators.validate_email]
    477477
  • docs/index.txt

    diff --git a/docs/index.txt b/docs/index.txt
    index a5d2e13..11ecc0d 100644
    a b Other batteries included  
    174174* :doc:`Cross Site Request Forgery protection <ref/contrib/csrf>`
    175175* :doc:`Cryptographic signing <topics/signing>`
    176176* :doc:`Databrowse <ref/contrib/databrowse>`
    177 * :doc:`E-mail (sending) <topics/email>`
     177* :doc:`Email (sending) <topics/email>`
    178178* :doc:`Flatpages <ref/contrib/flatpages>`
    179179* :doc:`GeoDjango <ref/contrib/gis/index>`
    180180* :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.  
    3737* The :mod:`django.contrib.gis.db.backend` module will be removed in favor
    3838  of the specific backends.
    3939
    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.
    4141
    4242* The many to many SQL generation functions on the database backends
    4343  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  
    105105messages::
    106106
    107107    >>> 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.']}
    109109
    110110In this dictionary, the keys are the field names, and the values are lists of
    111111Unicode strings representing the error messages. The error messages are stored
    method you're using::  
    537537    >>> print f.as_table()
    538538    <tr><th>Subject:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="subject" maxlength="100" /></td></tr>
    539539    <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>
    541541    <tr><th>Cc myself:</th><td><input checked="checked" type="checkbox" name="cc_myself" /></td></tr>
    542542    >>> print f.as_ul()
    543543    <li><ul class="errorlist"><li>This field is required.</li></ul>Subject: <input type="text" name="subject" maxlength="100" /></li>
    544544    <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>
    546546    <li>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></li>
    547547    >>> print f.as_p()
    548548    <p><ul class="errorlist"><li>This field is required.</li></ul></p>
    549549    <p>Subject: <input type="text" name="subject" maxlength="100" /></p>
    550550    <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>
    552552    <p>Sender: <input type="text" name="sender" value="invalid email address" /></p>
    553553    <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p>
    554554
    pass that in at construction time::  
    571571    <div class="errorlist"><div class="error">This field is required.</div></div>
    572572    <p>Subject: <input type="text" name="subject" maxlength="100" /></p>
    573573    <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>
    575575    <p>Sender: <input type="text" name="sender" value="invalid email address" /></p>
    576576    <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p>
    577577
  • 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::  
    3030    >>> f.clean('invalid email address')
    3131    Traceback (most recent call last):
    3232    ...
    33     ValidationError: [u'Enter a valid e-mail address.']
     33    ValidationError: [u'Enter a valid email address.']
    3434
    3535Core field arguments
    3636--------------------
  • 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``::  
    187187
    188188    class EmailField(CharField):
    189189        default_error_messages = {
    190             'invalid': _(u'Enter a valid e-mail address.'),
     190            'invalid': _(u'Enter a valid email address.'),
    191191        }
    192192        default_validators = [validators.validate_email]
    193193
    on field definition so::  
    200200is equivalent to::
    201201
    202202    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.')})
    204204
    205205
    206206Form 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.  
    15491549    "a@a.com" as a valid email address, but rejects "aaa" with a reasonable
    15501550    error message::
    15511551
    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.']})
    15531553
    15541554
    15551555.. 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):  
    214214        self.assertEqual(response.status_code, 200)
    215215        self.assertTemplateUsed(response, "Invalid POST Template")
    216216
    217         self.assertFormError(response, 'form', 'email', 'Enter a valid e-mail address.')
     217        self.assertFormError(response, 'form', 'email', 'Enter a valid email address.')
    218218
    219219    def test_valid_form_with_template(self):
    220220        "POST valid data to a form using multiple templates"
    class ClientTest(TestCase):  
    262262        self.assertTemplateUsed(response, 'base.html')
    263263        self.assertTemplateNotUsed(response, "Invalid POST Template")
    264264
    265         self.assertFormError(response, 'form', 'email', 'Enter a valid e-mail address.')
     265        self.assertFormError(response, 'form', 'email', 'Enter a valid email address.')
    266266
    267267    def test_unknown_page(self):
    268268        "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):  
    864864        self.assertFalse(login.context)
    865865        self.client.get('/test_admin/admin/logout/')
    866866
    867         # Test if user enters e-mail address
     867        # Test if user enters email address
    868868        request = self.client.get('/test_admin/admin/')
    869869        self.assertEqual(request.status_code, 200)
    870870        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")
    872872        # only correct passwords get a username hint
    873873        login = self.client.post('/test_admin/admin/', self.super_email_bad_login)
    874874        self.assertContains(login, ERROR_MESSAGE)
    875875        new_user = User(username='jondoe', password='secret', email='super@example.com')
    876876        new_user.save()
    877         # check to ensure if there are multiple e-mail addresses a user doesn't get a 500
     877        # check to ensure if there are multiple email addresses a user doesn't get a 500
    878878        login = self.client.post('/test_admin/admin/', self.super_email_login)
    879879        self.assertContains(login, ERROR_MESSAGE)
    880880
    class SecureViewTests(TestCase):  
    14941494        # make sure the view removes test cookie
    14951495        self.assertEqual(self.client.session.test_cookie_worked(), False)
    14961496
    1497         # Test if user enters e-mail address
     1497        # Test if user enters email address
    14981498        request = self.client.get('/test_admin/admin/secure-view/')
    14991499        self.assertEqual(request.status_code, 200)
    15001500        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")
    15021502        # only correct passwords get a username hint
    15031503        login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login)
    15041504        self.assertContains(login, ERROR_MESSAGE)
    15051505        new_user = User(username='jondoe', password='secret', email='super@example.com')
    15061506        new_user.save()
    1507         # check to ensure if there are multiple e-mail addresses a user doesn't get a 500
     1507        # check to ensure if there are multiple email addresses a user doesn't get a 500
    15081508        login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login)
    15091509        self.assertContains(login, ERROR_MESSAGE)
    15101510
  • 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):  
    602602        data = dict(email='invalid')
    603603        f = CommentForm(data, auto_id=False, error_class=DivErrorList)
    604604        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>
    606606<p>Email: <input type="text" name="email" value="invalid" /></p>
    607607<div class="errorlist"><div class="error">This field is required.</div></div>
    608608<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):  
    527527        self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, '')
    528528        self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, None)
    529529        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')
    537537        self.assertEqual(u'example@valid-----hyphens.com', f.clean('example@valid-----hyphens.com'))
    538538        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')
    540540        self.assertEqual(u'local@domain.with.idn.xyz\xe4\xf6\xfc\xdfabc.part.com', f.clean('local@domain.with.idn.xyzäöüßabc.part.com'))
    541541
    542542    def test_email_regexp_for_performance(self):
    class FieldsTests(SimpleTestCase):  
    545545        # if the security fix isn't in place.
    546546        self.assertRaisesMessage(
    547547                ValidationError,
    548                 "[u'Enter a valid e-mail address.']",
     548                "[u'Enter a valid email address.']",
    549549                f.clean,
    550550                'viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058'
    551551            )
    class FieldsTests(SimpleTestCase):  
    556556        self.assertEqual(u'', f.clean(None))
    557557        self.assertEqual(u'person@example.com', f.clean('person@example.com'))
    558558        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')
    562562
    563563    def test_emailfield_3(self):
    564564        f = EmailField(min_length=10, max_length=15)
    class FieldsTests(SimpleTestCase):  
    967967        f = ComboField(fields=[CharField(max_length=20), EmailField()])
    968968        self.assertEqual(u'test@example.com', f.clean('test@example.com'))
    969969        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')
    971971        self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, '')
    972972        self.assertRaisesMessage(ValidationError, "[u'This field is required.']", f.clean, None)
    973973
    class FieldsTests(SimpleTestCase):  
    975975        f = ComboField(fields=[CharField(max_length=20), EmailField()], required=False)
    976976        self.assertEqual(u'test@example.com', f.clean('test@example.com'))
    977977        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')
    979979        self.assertEqual(u'', f.clean(''))
    980980        self.assertEqual(u'', f.clean(None))
    981981
  • 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):  
    492492        try:
    493493            self.assertFormError(response, 'form', 'email', 'Some error.')
    494494        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))
    496496        try:
    497497            self.assertFormError(response, 'form', 'email', 'Some error.', msg_prefix='abc')
    498498        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))
    500500
    501501    def test_unknown_nonfield_error(self):
    502502        """
  • 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):  
    477477class AssertFieldOutputTests(SimpleTestCase):
    478478
    479479    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.']
    481481        self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid})
    482482        self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid + [u'Another error']})
    483483        self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid})
Back to Top