[IMP] check if handler returned a response already: just wrap return value if it's a string, otherwise let it through as is

bzr revid: xmo@openerp.com-20110902104920-c0cpwmg62y70tx1b
This commit is contained in:
Xavier Morel 2011-09-02 12:49:20 +02:00
parent 0e646fc6ff
commit edc5a3904f
1 changed files with 3 additions and 3 deletions

View File

@ -253,12 +253,12 @@ class Root(object):
result = handler(
request, self.config)
if isinstance(result, werkzeug.wrappers.Response):
response = result
else:
if isinstance(result, basestring):
response = werkzeug.wrappers.Response(
result, headers=[('Content-Type', 'text/html; charset=utf-8'),
('Content-Length', len(result))])
else:
response = result
response.set_cookie(self.session_cookie, session.sid)