mirror of https://github.com/django/django.git
Fixed #281 -- Made e-mail address validation much more strict and accurate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
911a6dfe04
commit
a218cf5798
|
@ -17,7 +17,8 @@ alnumurl_re = re.compile(r'^[\w/]+$')
|
|||
ansi_date_re = re.compile('^%s$' % _datere)
|
||||
ansi_time_re = re.compile('^%s$' % _timere)
|
||||
ansi_datetime_re = re.compile('^%s %s$' % (_datere, _timere))
|
||||
email_re = re.compile(r'^[-\w.+]+@\w[\w.-]+$')
|
||||
# From http://www.twilightsoul.com/Default.aspx?tabid=134
|
||||
email_re = re.compile(r'^((([\t\x20]*[!#-\'\*\+\-/-9=\?A-Z\^-~]+[\t\x20]*|"[\x01-\x09\x0B\x0C\x0E-\x21\x23-\x5B\x5D-\x7F]*")+)?[\t\x20]*<([\t\x20]*[!#-\'\*\+\-/-9=\?A-Z\^-~]+(\.[!#-\'\*\+\-/-9=\?A-Z\^-~]+)*|"[\x01-\x09\x0B\x0C\x0E-\x21\x23-\x5B\x5D-\x7F]*")@(([a-zA-Z0-9][-a-zA-Z0-9]*[a-zA-Z0-9]\.)+[a-zA-Z]{2,}|\[(([0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\])>[\t\x20]*|([\t\x20]*[!#-\'\*\+\-/-9=\?A-Z\^-~]+(\.[!#-\'\*\+\-/-9=\?A-Z\^-~]+)*|"[\x01-\x09\x0B\x0C\x0E-\x21\x23-\x5B\x5D-\x7F]*")@(([a-zA-Z0-9][-a-zA-Z0-9]*[a-zA-Z0-9]\.)+[a-zA-Z]{2,}|\[(([0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\]))$')
|
||||
integer_re = re.compile(r'^-?\d+$')
|
||||
ip4_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$')
|
||||
phone_re = re.compile(r'^[A-PR-Y0-9]{3}-[A-PR-Y0-9]{3}-[A-PR-Y0-9]{4}$', re.IGNORECASE)
|
||||
|
|
|
@ -244,7 +244,7 @@ Here are all available field types:
|
|||
|
||||
``EmailField``
|
||||
A ``CharField`` that checks that the value is a valid e-mail address.
|
||||
(Currently, this is a loose test.) This doesn't accept ``maxlength``.
|
||||
This doesn't accept ``maxlength``.
|
||||
|
||||
``FileField``
|
||||
A file-upload field.
|
||||
|
|
Loading…
Reference in New Issue