summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2015-10-31 22:59:59 +0100
committerMarcel Hellkamp <marc@gsites.de>2015-11-01 00:02:15 +0100
commitb24483e587860e46d96961ab5d1d660a427193e3 (patch)
tree27a99a576bef381b0c7bca1625c3125bc7002a02
parentd85a6983ceedacd9ab9afbcd027139d8773b67ac (diff)
downloadbottle-b24483e587860e46d96961ab5d1d660a427193e3.tar.gz
Maintain BH fpor after-request hooks.
If you need to handle exceptions (e.g. to close DB connetions) use the plugin API instead of hooks.
-rw-r--r--bottle.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/bottle.py b/bottle.py
index b3c244a..7ec7a26 100644
--- a/bottle.py
+++ b/bottle.py
@@ -942,7 +942,6 @@ class Bottle(object):
except (KeyboardInterrupt, SystemExit, MemoryError):
raise
except Exception:
- exc =
if not self.catchall: raise
stacktrace = format_exc()
environ['wsgi.errors'].write(stacktrace)
@@ -959,7 +958,7 @@ class Bottle(object):
finally:
if isinstance(out, HTTPResponse):
out.apply(response)
- self.trigger_hook('after_request', exc)
+ self.trigger_hook('after_request')
def _cast(self, out, peek=None):
""" Try to convert the parameter into something WSGI compatible and set
@@ -1746,7 +1745,7 @@ class BaseResponse(object):
value = touni(cookie_encode((name, value), secret))
elif not isinstance(value, basestring):
raise TypeError('Secret key missing for non-string Cookie.')
-
+
# Cookie size plus options must not exceed 4kb.
if len(name) + len(value) > 3800:
raise ValueError('Content does not fit into a cookie.')
@@ -1846,10 +1845,10 @@ class HTTPError(HTTPResponse):
status=None,
body=None,
exception=None,
- traceback=None, **options):
+ traceback=None, **more_headers):
self.exception = exception
self.traceback = traceback
- super(HTTPError, self).__init__(body, status, **options)
+ super(HTTPError, self).__init__(body, status, **more_headers)
###############################################################################
# Plugins ######################################################################