diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-04-16 14:24:27 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-04-16 14:24:27 +0000 |
| commit | 48b459a83e40aa6dae588f114d68f54b95e860de (patch) | |
| tree | 39f8c75e470117c686ace23459c2f0438072e1e2 /django/forms/fields.py | |
| parent | 4eaf4155f809c320e4b24e0f437ed9e1d856f9ef (diff) | |
Fixed #9890 -- Modified the regex validation for email addresses to match RFC822/1035. Thanks to ozgur for the report, and kratorius for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/fields.py')
| -rw-r--r-- | django/forms/fields.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index bd4f3d4a80..ab3fe67aeb 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -256,8 +256,8 @@ class DecimalField(Field): digits = len(digittuple) if decimals > digits: # We have leading zeros up to or past the decimal point. Count - # everything past the decimal point as a digit. We do not count - # 0 before the decimal point as a digit since that would mean + # everything past the decimal point as a digit. We do not count + # 0 before the decimal point as a digit since that would mean # we would not allow max_digits = decimal_places. digits = decimals whole_digits = digits - decimals @@ -283,7 +283,7 @@ DEFAULT_DATE_INPUT_FORMATS = ( ) class DateField(Field): - widget = DateInput + widget = DateInput default_error_messages = { 'invalid': _(u'Enter a valid date.'), } @@ -422,7 +422,7 @@ class RegexField(CharField): email_re = re.compile( r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string - r')@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain + r')@(?:[A-Z0-9]+(?:-*[A-Z0-9]+)*\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain class EmailField(RegexField): default_error_messages = { @@ -829,7 +829,7 @@ class FilePathField(ChoiceField): super(FilePathField, self).__init__(choices=(), required=required, widget=widget, label=label, initial=initial, help_text=help_text, *args, **kwargs) - + if self.required: self.choices = [] else: |
