Changeset 6173
- Timestamp:
- 09/14/07 02:02:55 (1 year ago)
- Files:
-
- django/trunk/django/newforms/fields.py (modified) (1 diff)
- django/trunk/tests/regressiontests/forms/tests.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/newforms/fields.py
r6156 r6173 417 417 418 418 def clean(self, value): 419 # If no URL scheme given, assume http:// 420 if value and '://' not in value: 421 value = u'http://%s' % value 419 422 value = super(URLField, self).clean(value) 420 423 if value == u'': django/trunk/tests/regressiontests/forms/tests.py
r6156 r6173 1624 1624 ... 1625 1625 ValidationError: [u'Enter a valid URL.'] 1626 >>> f.clean('example.com')1627 Traceback (most recent call last):1628 ...1629 ValidationError: [u'Enter a valid URL.']1630 1626 >>> f.clean('http://') 1631 1627 Traceback (most recent call last): … … 1658 1654 ... 1659 1655 ValidationError: [u'Enter a valid URL.'] 1660 >>> f.clean('example.com')1661 Traceback (most recent call last):1662 ...1663 ValidationError: [u'Enter a valid URL.']1664 1656 >>> f.clean('http://') 1665 1657 Traceback (most recent call last): … … 1714 1706 ... 1715 1707 ValidationError: [u'Ensure this value has at most 20 characters (it has 37).'] 1708 1709 URLField should prepend 'http://' if no scheme was given 1710 >>> f = URLField(required=False) 1711 >>> f.clean('example.com') 1712 u'http://example.com' 1713 >>> f.clean('') 1714 u'' 1715 >>> f.clean('https://example.com') 1716 u'https://example.com' 1716 1717 1717 1718 # BooleanField ################################################################
