-
-
Save SmileyChris/1821636 to your computer and use it in GitHub Desktop.
Formatting horrible if
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_validators(self, value): | |
if value in validators.EMPTY_VALUES: | |
return | |
errors = [] | |
for v in self.validators: | |
try: | |
v(value) | |
except ValidationError, e: | |
message = None | |
if hasattr(e, 'code'): | |
messages = self.default_error_messages.copy() | |
messages.update(self.error_messages) | |
message = messages.get(e.code, '') | |
if getattr(e, 'params', None): | |
message = message % e.params | |
if message: | |
errors.append(message) | |
else: | |
errors.extend(e.messages) | |
if errors: | |
raise ValidationError(errors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment