summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2011-06-09 23:51:03 +0000
committerChris Beaven <smileychris@gmail.com>2011-06-09 23:51:03 +0000
commitb56ef75088e17fa3555766e92a6747411ccd738c (patch)
tree09fe93f584d40a9354551c29260b3cd53ece8d34 /django
parentdb2f9bfae173b565215a9f7320d7a45d0532f2fe (diff)
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
Diffstat (limited to 'django')
-rw-r--r--django/core/validators.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index a40af0c8dd..74db11697b 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -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):
"""