diff options
-rwxr-xr-x | bottle.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -452,6 +452,11 @@ class Bottle(object): Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, iterable of strings and iterable of unicodes """ + # Filtered types (recursive, because they may return anything) + for testtype, filterfunc in self.castfilter: + if isinstance(out, testtype): + return self._cast(filterfunc(out)) + # Empty output is done here if not out: response.headers['Content-Length'] = 0 @@ -474,11 +479,6 @@ class Bottle(object): out.apply(response) return self._cast(out.output) - # Filtered types (recursive, because they may return anything) - for testtype, filterfunc in self.castfilter: - if isinstance(out, testtype): - return self._cast(filterfunc(out)) - # Cast Files into iterables if hasattr(out, 'read') and 'wsgi.file_wrapper' in request.environ: out = request.environ.get('wsgi.file_wrapper', |