diff options
author | Marcel Hellkamp <marc@gsites.de> | 2010-03-15 15:06:42 +0100 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2010-03-15 15:13:03 +0100 |
commit | 53868f5b66a8cac3d48231220b485f27555e81a5 (patch) | |
tree | 91145bb940d95e5b9f278840cea49fcec0f4e07c | |
parent | f48dbea51185e5b02ef09f83e7704b1762114c8a (diff) | |
download | bottle-async.tar.gz |
Fix: The last commit was broken, sorry.async
-rwxr-xr-x | bottle.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -488,7 +488,7 @@ class Bottle(object): # Filtered types (recursive, because they may return anything) for testtype, filterfunc, final in self.castfilter: if isinstance(out, testtype): - return filterfunc(out) if final else self._cast(filterfunc(out)) + return filterfunc(out) if final else self._cast(filterfunc(out), request, response) # Empty output is done here if not out: @@ -507,10 +507,10 @@ class Bottle(object): # HTTPError or HTTPException (recursive, because they may wrap anything) if isinstance(out, HTTPError): out.apply(response) - return self._cast(self.error_handler.get(out.status, repr)(out)) + return self._cast(self.error_handler.get(out.status, repr)(out), request, response) if isinstance(out, HTTPResponse): out.apply(response) - return self._cast(out.output) + return self._cast(out.output, request, response) # Cast Files into iterables if hasattr(out, 'read') and 'wsgi.file_wrapper' in request.environ: @@ -524,7 +524,7 @@ class Bottle(object): while not first: first = out.next() except StopIteration: - return self._cast('') + return self._cast('', request, response) except HTTPResponse, e: first = e except Exception, e: @@ -534,14 +534,14 @@ class Bottle(object): raise # These are the inner types allowed in iterator or generator objects. if isinstance(first, HTTPResponse): - return self._cast(first) + return self._cast(first, request, response) if isinstance(first, StringType): return itertools.chain([first], out) if isinstance(first, unicode): return itertools.imap(lambda x: x.encode(response.charset), itertools.chain([first], out)) return self._cast(HTTPError(500, 'Unsupported response type: %s'\ - % type(first))) + % type(first)), request, response) def __call__(self, environ, start_response): """ The bottle WSGI-interface. """ @@ -797,7 +797,7 @@ class Response(threading.local): """ Represents a single HTTP response using thread-local attributes. """ - def __init__(self, start_response, app): + def __init__(self, start_response=None, app=None): self.bind(start_response, app) def bind(self, start_response, app): |