summaryrefslogtreecommitdiff
path: root/django/http
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 /django/http
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 'django/http')
-rw-r--r--django/http/__init__.py4
-rw-r--r--django/http/multipartparser.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py
index 577f1d8170..382f3c3f17 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -290,7 +290,7 @@ class HttpRequest(object):
raise Exception("You cannot access body after reading from request's data stream")
try:
self._body = self.read()
- except IOError, e:
+ except IOError as e:
raise UnreadablePostError, e, sys.exc_traceback
self._stream = StringIO(self._body)
return self._body
@@ -556,7 +556,7 @@ class HttpResponse(object):
if isinstance(value, unicode):
try:
value = value.encode('us-ascii')
- except UnicodeError, e:
+ except UnicodeError as e:
e.reason += ', HTTP response headers must be in US-ASCII format'
raise
else:
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 477a08c05a..024e11a09c 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -196,7 +196,7 @@ class MultiPartParser(object):
# We only special-case base64 transfer encoding
try:
chunk = str(chunk).decode('base64')
- except Exception, e:
+ except Exception as e:
# Since this is only a chunk, any error is an unfixable error.
raise MultiPartParserError("Could not decode base64 data: %r" % e)
@@ -209,7 +209,7 @@ class MultiPartParser(object):
# If the chunk received by the handler is None, then don't continue.
break
- except SkipFile, e:
+ except SkipFile:
# Just use up the rest of this file...
exhaust(field_stream)
else:
@@ -218,7 +218,7 @@ class MultiPartParser(object):
else:
# If this is neither a FIELD or a FILE, just exhaust the stream.
exhaust(stream)
- except StopUpload, e:
+ except StopUpload as e:
if not e.connection_reset:
exhaust(self._input_data)
else: