summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-08-04 15:05:55 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-08-04 15:05:55 +0000
commit63eecadfc66a1b52abda9921598750ea27095456 (patch)
tree087e7e0f562ba5999b6caa27fd688106e972bc19
parent0c6019295a86140fd231bccabc987496f23393eb (diff)
Tightened up some code in django.core.validators
git-svn-id: http://code.djangoproject.com/svn/django/trunk@404 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/validators.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 2e7fc847b2..9cd6ddad30 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -211,9 +211,8 @@ class AlwaysMatchesOtherField:
raise ValidationError, self.error_message
class RequiredIfOtherFieldNotGiven:
- def __init__(self, other_field_name, error_message=None):
- self.other = other_field_name
- self.error_message = error_message or "Please enter something for at least one field."
+ def __init__(self, other_field_name, error_message="Please enter something for at least one field."):
+ self.other, self.error_message = other_field_name, error_message
self.always_test = True
def __call__(self, field_data, all_data):
@@ -222,8 +221,7 @@ class RequiredIfOtherFieldNotGiven:
class RequiredIfOtherFieldsGiven:
def __init__(self, other_field_names, error_message="Please enter both fields or leave them both empty."):
- self.other = other_field_names
- self.error_message = error_message
+ self.other, self.error_message = other_field_names, error_message
self.always_test = True
def __call__(self, field_data, all_data):