1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

Fixed #15229 -- Improved URLValidator to accept ftp:// links. Thanks, codefisher and crayz_train

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2011-03-16 03:38:34 +00:00
parent ebd5682989
commit f71384a52b
2 changed files with 13 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ class HeadRequest(urllib2.Request):
class URLValidator(RegexValidator):
regex = re.compile(
r'^https?://' # http:// or https://
r'^(?:http|ftp)s?://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
r'localhost|' #localhost...
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip