parent
afcbf3d314
commit
5735d2b027
|
@ -25,7 +25,6 @@ from milla.controllers import FaviconController
|
|||
from milla.util import asbool
|
||||
from webob.exc import HTTPNotFound, WSGIHTTPException, HTTPMethodNotAllowed
|
||||
import milla.dispatch
|
||||
import webob
|
||||
|
||||
__all__ = ['Application']
|
||||
|
||||
|
@ -126,9 +125,16 @@ class Application(object):
|
|||
func.func.im_self.__after__(request)
|
||||
|
||||
# The callable might have returned just a string, which is OK,
|
||||
# but we need to wrap it in a WebOb response
|
||||
# but we need to wrap it in a Response object
|
||||
try:
|
||||
# In Python 2, it could be a str or a unicode object
|
||||
basestring = basestring #@UndefinedVariable
|
||||
except NameError:
|
||||
# Python 3 has no unicode objects and thus no need for
|
||||
# basestring so we, just make it an alias for str
|
||||
basestring = str
|
||||
if isinstance(response, basestring) or not response:
|
||||
response = webob.Response(response)
|
||||
response = request.ResponseClass(response)
|
||||
|
||||
if not start_response_wrapper.called:
|
||||
start_response(response.status, response.headerlist)
|
||||
|
|
Loading…
Reference in New Issue