Changes between Initial Version and Version 2 of Ticket #18517
- Timestamp:
- Jun 26, 2012, 4:29:21 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #18517
- Property Cc added
- Property Component Uncategorized → Core (URLs)
- Property Easy pickings set
- Property Keywords URLFiled added
- Property Type Uncategorized → Bug
-
Ticket #18517 – Description
initial v2 1 1 if your url has a '_' in it, like this: 2 http://django_compressor.readthedocs.org/2 * http://django_compressor.readthedocs.org/ 3 3 the URLField will complain that it is not a valid url. the problem lies in the '_' symbol. I find in the source code as Following: 4 class URLValidator(RegexValidator): 5 regex = re.compile( 6 r'^(?:http|ftp)s?://' # http:// or https:// 7 r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain... 8 r'localhost|' #localhost... 9 r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip 10 r'(?::\d+)?' # optional port 11 r'(?:/?|[/?]\S+)$', re.IGNORECASE) 4 {{{ 5 class URLValidator(RegexValidator): 6 regex = re.compile( 7 r'^(?:http|ftp)s?://' # http:// or https:// 8 r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain... 9 r'localhost|' #localhost... 10 r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip 11 r'(?::\d+)?' # optional port 12 r'(?:/?|[/?]\S+)$', re.IGNORECASE) 13 }}} 14 12 15 the related part is this line: 16 {{{ 13 17 r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' 18 }}} 19 14 20 It's clear that '_' is not included in the pattern. 15 21 I think this is not reaonable for there's a lot of url has a '_' in it.