summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2012-03-15 15:30:13 +0100
committerHelmut Grohne <helmut@subdivi.de>2012-03-15 15:30:13 +0100
commitbaf09b8dca391a7851cdf08d86dcbe3edec369ff (patch)
tree873a537a4afc9b68ba76a43a2e53feebc279e253 /wsgitools
parent78250ca9b638bf71be579dfc5fc40b9a2d96f711 (diff)
downloadwsgitools-baf09b8dca391a7851cdf08d86dcbe3edec369ff.tar.gz
raise exc_info stuff properly
Diffstat (limited to 'wsgitools')
-rw-r--r--wsgitools/middlewares.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index 9792089..804d474 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -17,6 +17,13 @@ except NameError:
def next(iterator):
return iterator.next()
+if sys.version_info[0] >= 3:
+ def exc_info_for_raise(exc_info):
+ return exc_info[0](exc_info[1]).with_traceback(exc_info[2])
+else:
+ def exc_info_for_raise(exc_info):
+ return exc_info[0], exc_info[1], exc_info[2]
+
from wsgitools.filters import CloseableList, CloseableIterator
from wsgitools.authentication import AuthenticationRequired, \
ProtocolViolation, AuthenticationMiddleware
@@ -79,7 +86,7 @@ class NoWriteCallableMiddleware:
try:
if sio.tell() > 0 or gotiterdata:
assert exc_info is not None
- raise exc_info[0], exc_info[1], exc_info[2]
+ raise exc_info_for_raise(exc_info)
finally:
exc_info = None
assert isinstance(status, str)
@@ -148,7 +155,7 @@ class ContentLengthMiddleware:
try:
if gotdata:
assert exc_info is not None
- raise exc_info[0], exc_info[1], exc_info[2]
+ raise exc_info_for_raise(exc_info)
finally:
exc_info = None
assert isinstance(status, str)
@@ -281,7 +288,7 @@ class CachingMiddleware:
try:
if cache_object[3]:
assert exc_info is not None
- raise exc_info[0], exc_info[1], exc_info[2]
+ raise exc_info_for_raise(exc_info)
finally:
exc_info = None
assert isinstance(status, str)