From 3904b74a3f2f92fefe1d39281ed683c52f2fef03 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 28 Apr 2012 18:09:37 +0200 Subject: Fixed #18013 -- Use the new 'as' syntax for exceptions. Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6). --- django/forms/fields.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django/forms/fields.py') diff --git a/django/forms/fields.py b/django/forms/fields.py index 3cf730e152..39f8f9c846 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -132,7 +132,7 @@ class Field(object): for v in self.validators: try: v(value) - except ValidationError, e: + except ValidationError as e: if hasattr(e, 'code') and e.code in self.error_messages: message = self.error_messages[e.code] if e.params: @@ -884,7 +884,7 @@ class MultiValueField(Field): raise ValidationError(self.error_messages['required']) try: clean_data.append(field.clean(field_value)) - except ValidationError, e: + except ValidationError as e: # Collect all validation errors in a single list, which we'll # raise at the end of clean(), rather than raising a single # exception for the first error we encounter. -- cgit v1.3