From 94af19c43fad3e42d64981e22fe15b844f1f9eb6 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 1 Apr 2011 16:10:22 +0000 Subject: Changed e-mail to email throughout documentation and codebase. The one exception is translation strings, which I didn't want to disrupt git-svn-id: http://code.djangoproject.com/svn/django/trunk@15967 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/forms/api.txt | 22 +++++++++++----------- docs/ref/forms/fields.txt | 16 ++++++++-------- docs/ref/forms/validation.txt | 10 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 81544ca2b5..bd8948cc08 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -89,11 +89,11 @@ and return a boolean designating whether the data was valid:: Let's try with some invalid data. In this case, ``subject`` is blank (an error, because all fields are required by default) and ``sender`` is not a valid -e-mail address:: +email address:: >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data) >>> f.is_valid() @@ -105,7 +105,7 @@ Access the :attr:`~Form.errors` attribute to get a dictionary of error messages:: >>> f.errors - {'sender': [u'Enter a valid e-mail address.'], 'subject': [u'This field is required.']} + {'sender': [u'Enter a valid email address.'], 'subject': [u'This field is required.']} In this dictionary, the keys are the field names, and the values are lists of Unicode strings representing the error messages. The error messages are stored @@ -204,7 +204,7 @@ If your data does *not* validate, your ``Form`` instance will not have a >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data) >>> f.is_valid() @@ -531,25 +531,25 @@ method you're using:: >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data, auto_id=False) >>> print f.as_table() Subject: Message: - Sender: + Sender: Cc myself: >>> print f.as_ul()
  • Subject:
  • Message:
  • -
  • Sender:
  • +
  • Sender:
  • Cc myself:
  • >>> print f.as_p()

    Subject:

    Message:

    -

    -

    Sender:

    +

    +

    Sender:

    Cc myself:

    Customizing the error list format @@ -571,8 +571,8 @@ pass that in at construction time::
    This field is required.

    Subject:

    Message:

    -
    Enter a valid e-mail address.
    -

    Sender:

    +
    Enter a valid email address.
    +

    Sender:

    Cc myself:

    More granular output diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index b49864f7cf..73d8b02869 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -27,10 +27,10 @@ exception or returns the clean value:: u'foo@example.com' >>> f.clean(u'foo@example.com') u'foo@example.com' - >>> f.clean('invalid e-mail address') + >>> f.clean('invalid email address') Traceback (most recent call last): ... - ValidationError: [u'Enter a valid e-mail address.'] + ValidationError: [u'Enter a valid email address.'] Core field arguments -------------------- @@ -208,23 +208,23 @@ fields. We've specified ``auto_id=False`` to simplify the output:: >>> class HelpTextContactForm(forms.Form): ... subject = forms.CharField(max_length=100, help_text='100 characters max.') ... message = forms.CharField() - ... sender = forms.EmailField(help_text='A valid e-mail address, please.') + ... sender = forms.EmailField(help_text='A valid email address, please.') ... cc_myself = forms.BooleanField(required=False) >>> f = HelpTextContactForm(auto_id=False) >>> print f.as_table() Subject:
    100 characters max. Message: - Sender:
    A valid e-mail address, please. + Sender:
    A valid email address, please. Cc myself: >>> print f.as_ul()
  • Subject: 100 characters max.
  • Message:
  • -
  • Sender: A valid e-mail address, please.
  • +
  • Sender: A valid email address, please.
  • Cc myself:
  • >>> print f.as_p()

    Subject: 100 characters max.

    Message:

    -

    Sender: A valid e-mail address, please.

    +

    Sender: A valid email address, please.

    Cc myself:

    ``error_messages`` @@ -481,7 +481,7 @@ Takes four optional arguments: * Default widget: ``TextInput`` * Empty value: ``''`` (an empty string) * Normalizes to: A Unicode object. - * Validates that the given value is a valid e-mail address, using a + * Validates that the given value is a valid email address, using a moderately complex regular expression. * Error message keys: ``required``, ``invalid`` @@ -490,7 +490,7 @@ If provided, these arguments ensure that the string is at most or at least the given length. .. versionchanged:: 1.2 - The EmailField previously did not recognize e-mail addresses as valid that + The EmailField previously did not recognize email addresses as valid that contained an IDN (Internationalized Domain Name; a domain containing unicode characters) domain part. This has now been corrected. diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt index d5f40706a1..d8f896deb2 100644 --- a/docs/ref/forms/validation.txt +++ b/docs/ref/forms/validation.txt @@ -77,7 +77,7 @@ overridden: * The Form subclass's ``clean()`` method. This method can perform any validation that requires access to multiple fields from the form at once. This is where you might put in things to check that if field ``A`` - is supplied, field ``B`` must contain a valid e-mail address and the + is supplied, field ``B`` must contain a valid email address and the like. The data that this method returns is the final ``cleaned_data`` attribute for the form, so don't forget to return the full list of cleaned data if you override this method (by default, ``Form.clean()`` @@ -187,12 +187,12 @@ a look at Django's ``EmailField``:: class EmailField(CharField): default_error_messages = { - 'invalid': _(u'Enter a valid e-mail address.'), + 'invalid': _(u'Enter a valid email address.'), } default_validators = [validators.validate_email] As you can see, ``EmailField`` is just a ``CharField`` with customized error -message and a validator that validates e-mail addresses. This can also be done +message and a validator that validates email addresses. This can also be done on field definition so:: email = forms.EmailField() @@ -200,14 +200,14 @@ on field definition so:: is equivalent to:: email = forms.CharField(validators=[validators.validate_email], - error_messages={'invalid': _(u'Enter a valid e-mail address.')}) + error_messages={'invalid': _(u'Enter a valid email address.')}) Form field default cleaning ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's firstly create a custom form field that validates its input is a string -containing comma-separated e-mail addresses. The full class looks like this:: +containing comma-separated email addresses. The full class looks like this:: from django import forms from django.core.validators import validate_email -- cgit v1.3