1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixes #13511 -- make regex parameter to RegexValidator to be optional. Also tidies up related docs (parameters aren't attributes). Thanks for the patch work, davidfischer.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16351 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Chris Beaven
2011-06-09 23:51:03 +00:00
parent db2f9bfae1
commit b56ef75088
3 changed files with 28 additions and 14 deletions

View File

@@ -29,8 +29,9 @@ class RegexValidator(object):
if code is not None:
self.code = code
# Compile the regex if it was not passed pre-compiled.
if isinstance(self.regex, basestring):
self.regex = re.compile(regex)
self.regex = re.compile(self.regex)
def __call__(self, value):
"""