summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-04-28 18:09:37 +0200
committerClaude Paroz <claude@2xlibre.net>2012-04-29 20:57:15 +0200
commit3904b74a3f2f92fefe1d39281ed683c52f2fef03 (patch)
tree1ae8f65371ed53df205553f41c9d0f90d1e9fee9 /docs
parenteefb00f30124f775ca52258ccd8549054fe8230f (diff)
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).
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/instances.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 1f60f43c97..8eaf946825 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -72,7 +72,7 @@ Example::
try:
article.full_clean()
- except ValidationError, e:
+ except ValidationError as e:
# Do something based on the errors contained in e.message_dict.
# Display them to a user, or handle them programatically.
@@ -112,7 +112,7 @@ instead of to a specific field::
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
try:
article.full_clean()
- except ValidationError, e:
+ except ValidationError as e:
non_field_errors = e.message_dict[NON_FIELD_ERRORS]
Finally, ``full_clean()`` will check any unique constraints on your model.