summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-04-16 14:59:37 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-04-16 14:59:37 +0000
commit5f20587fcb43cac9a65b72d44a201edf0666dd07 (patch)
treedec6b7aed0bc9cad5c60e24e29925043f1749fd8 /django
parent33eca69b95bb1e7380767b51cfef068088396367 (diff)
[1.0.X] Fixed #9890 -- Modified the regex validation for email addresses to match RFC822/1035. Thanks to ozgur for the report, and kratorius for the patch.
Merge of 10573 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10576 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/forms/fields.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 63d06ab0eb..abfc4c4f99 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
@@ -421,7 +421,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 = {
@@ -828,7 +828,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: