Skip to content

Commit

Permalink
Tightened up some code in django.core.validators
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@404 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Aug 4, 2005
1 parent 0c60192 commit 63eecad
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions django/core/validators.py
Expand Up @@ -211,9 +211,8 @@ def __call__(self, field_data, all_data):
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):
Expand All @@ -222,8 +221,7 @@ def __call__(self, field_data, all_data):

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):
Expand Down

0 comments on commit 63eecad

Please sign in to comment.