Commit 683d6ce9 authored by Hanno Schlichting's avatar Hanno Schlichting

Move httpexceptions middleware into ZPublisher.

parent cea2d056
...@@ -111,7 +111,7 @@ setup( ...@@ -111,7 +111,7 @@ setup(
'main=Zope2.Startup.run:make_wsgi_app', 'main=Zope2.Startup.run:make_wsgi_app',
], ],
'paste.filter_app_factory': [ 'paste.filter_app_factory': [
'httpexceptions=Zope2.Startup.httpexceptions:main', 'httpexceptions=ZPublisher.httpexceptions:main',
], ],
'console_scripts': [ 'console_scripts': [
'addzope2user=Zope2.utilities.adduser:main', 'addzope2user=Zope2.utilities.adduser:main',
......
...@@ -24,7 +24,7 @@ from zope.interface import implements ...@@ -24,7 +24,7 @@ from zope.interface import implements
from Testing.ZopeTestCase import interfaces from Testing.ZopeTestCase import interfaces
from Testing.ZopeTestCase import sandbox from Testing.ZopeTestCase import sandbox
from Zope2.Startup.httpexceptions import HTTPExceptionHandler from ZPublisher.httpexceptions import HTTPExceptionHandler
def savestate(func): def savestate(func):
......
...@@ -33,7 +33,7 @@ from Testing.ZopeTestCase import standard_permissions ...@@ -33,7 +33,7 @@ from Testing.ZopeTestCase import standard_permissions
from Testing.ZopeTestCase.sandbox import AppZapper from Testing.ZopeTestCase.sandbox import AppZapper
from Testing.ZopeTestCase.functional import ResponseWrapper from Testing.ZopeTestCase.functional import ResponseWrapper
from Testing.ZopeTestCase.functional import savestate from Testing.ZopeTestCase.functional import savestate
from Zope2.Startup.httpexceptions import HTTPExceptionHandler from ZPublisher.httpexceptions import HTTPExceptionHandler
if sys.version_info >= (3, ): if sys.version_info >= (3, ):
basestring = str basestring = str
......
...@@ -292,10 +292,9 @@ def publish_module(environ, start_response, ...@@ -292,10 +292,9 @@ def publish_module(environ, start_response,
status, headers = response.finalize() status, headers = response.finalize()
start_response(status, headers) start_response(status, headers)
body = response.body if (isinstance(response.body, IOBase) or
if (isinstance(body, IOBase) or IUnboundStreamIterator.providedBy(response.body)):
IUnboundStreamIterator.providedBy(body)): result = response.body
result = body
else: else:
# If somebody used response.write, that data will be in the # If somebody used response.write, that data will be in the
# stdout StringIO, so we put that before the body. # stdout StringIO, so we put that before the body.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment