Ticket #6717: 6717-url-strip-v2-with-tests.diff
File 6717-url-strip-v2-with-tests.diff, 1.1 KB (added by , 17 years ago) |
---|
-
django/newforms/fields.py
505 505 self.user_agent = validator_user_agent 506 506 507 507 def clean(self, value): 508 if isinstance(value, basestring): 509 value = value.strip() 508 510 # If no URL scheme given, assume http:// 509 511 if value and '://' not in value: 510 512 value = u'http://%s' % value -
tests/regressiontests/forms/fields.py
923 923 >>> f.clean('https://example.com') 924 924 u'https://example.com' 925 925 926 URLField should strip leading and trailing space before validation. 927 >>> f = URLField(required=False) 928 >>> f.clean(' http://example.com') 929 u'http://example.com' 930 >>> f.clean('http://example.com ') 931 u'http://example.com' 932 >>> f.clean(' ') 933 u'' 934 926 935 # BooleanField ################################################################ 927 936 928 937 >>> f = BooleanField()