Changeset 6152
- Timestamp:
- 09/13/07 21:11:24 (11 months ago)
- Files:
-
- django/trunk/django/newforms/fields.py (modified) (2 diffs)
- django/trunk/tests/regressiontests/forms/tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/newforms/fields.py
r6096 r6152 336 336 ugettext(u'Enter a valid e-mail address.'), *args, **kwargs) 337 337 338 url_re = re.compile(339 r'^https?://' # http:// or https://340 r'(?:[A-Z0-9-]+\.)+[A-Z]{2,6}' # domain341 r'(?::\d+)?' # optional port342 r'(?:/?|/\S+)$', re.IGNORECASE)343 344 338 try: 345 339 from django.conf import settings … … 399 393 raise ValidationError(ugettext(u"Upload a valid image. The file you uploaded was either not an image or a corrupted image.")) 400 394 return f 395 396 url_re = re.compile( 397 r'^https?://' # http:// or https:// 398 r'(?:(?:[A-Z0-9-]+\.)+[A-Z]{2,6}|' #domain... 399 r'localhost|' #localhost... 400 r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip 401 r'(?::\d+)?' # optional port 402 r'(?:/?|/\S+)$', re.IGNORECASE) 401 403 402 404 class URLField(RegexField): django/trunk/tests/regressiontests/forms/tests.py
r6151 r6152 1608 1608 ... 1609 1609 ValidationError: [u'This field is required.'] 1610 >>> f.clean('http://localhost') 1611 u'http://localhost' 1610 1612 >>> f.clean('http://example.com') 1611 1613 u'http://example.com' 1612 1614 >>> f.clean('http://www.example.com') 1613 1615 u'http://www.example.com' 1616 >>> f.clean('http://www.example.com:8000/test') 1617 u'http://www.example.com:8000/test' 1618 >>> f.clean('http://200.8.9.10') 1619 u'http://200.8.9.10' 1620 >>> f.clean('http://200.8.9.10:8000/test') 1621 u'http://200.8.9.10:8000/test' 1614 1622 >>> f.clean('foo') 1615 1623 Traceback (most recent call last):
