Ticket #2276: validators.py.2.diff
File validators.py.2.diff, 1.0 KB (added by , 18 years ago) |
---|
-
django/core/validators.py
27 27 integer_re = re.compile(r'^-?\d+$') 28 28 ip4_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$') 29 29 phone_re = re.compile(r'^[A-PR-Y0-9]{3}-[A-PR-Y0-9]{3}-[A-PR-Y0-9]{4}$', re.IGNORECASE) 30 slug_re = re.compile(r'^[-\w]+$' )30 slug_re = re.compile(r'^[-\w]+$', re.UNICODE) 31 31 url_re = re.compile(r'^https?://\S+$') 32 32 33 33 lazy_inter = lazy(lambda a,b: str(a) % b, str) … … 67 67 raise ValidationError, gettext("This value must contain only letters, numbers, underscores, dashes or slashes.") 68 68 69 69 def isSlug(field_data, all_data): 70 if not slug_re.search( field_data):70 if not slug_re.search(unicode(field_data, 'utf-8')): 71 71 raise ValidationError, "This value must contain only letters, numbers, underscores or hyphens." 72 72 73 73 def isLowerCase(field_data, all_data):