Commit a2e8e90a authored by Malthe Borch's avatar Malthe Borch Committed by Tres Seaver

Ensure WSGIPublisher starts / ends interaction.

Make it analogous to the ZServer publisher.

Cherry-pick 41594f6d from master.
parent 857907e8
...@@ -181,6 +181,11 @@ http://docs.zope.org/zope2/ ...@@ -181,6 +181,11 @@ http://docs.zope.org/zope2/
Ported the ``shiftNameToApplication`` implementation from zope.publisher to Ported the ``shiftNameToApplication`` implementation from zope.publisher to
ZPublisher.HTTPRequest.HTTPRequest. ZPublisher.HTTPRequest.HTTPRequest.
- Ensure that the ``WSGIPublisher`` begins and ends an *interaction*
at the request/response barrier. This is required for instance for
the ``checkPermission`` call to function without an explicit
``interaction`` parameter.
- Ensure that ObjectManager's ``get`` and ``__getitem__`` methods return only - Ensure that ObjectManager's ``get`` and ``__getitem__`` methods return only
"items" (no attributes / methods from the class or from acquisition). "items" (no attributes / methods from the class or from acquisition).
Thanks to Richard Mitchell at Netsight for the report. Thanks to Richard Mitchell at Netsight for the report.
......
...@@ -19,6 +19,7 @@ import transaction ...@@ -19,6 +19,7 @@ import transaction
from zExceptions import Redirect from zExceptions import Redirect
from zExceptions import Unauthorized from zExceptions import Unauthorized
from zope.event import notify from zope.event import notify
from zope.security.management import newInteraction, endInteraction
from zope.publisher.skinnable import setDefaultSkin from zope.publisher.skinnable import setDefaultSkin
from ZServer.medusa.http_date import build_http_date from ZServer.medusa.http_date import build_http_date
...@@ -165,6 +166,7 @@ def publish(request, module_name, ...@@ -165,6 +166,7 @@ def publish(request, module_name,
) = _get_module_info(module_name) ) = _get_module_info(module_name)
notify(PubStart(request)) notify(PubStart(request))
newInteraction()
request.processInputs() request.processInputs()
response = request.response response = request.response
...@@ -205,6 +207,8 @@ def publish(request, module_name, ...@@ -205,6 +207,8 @@ def publish(request, module_name,
if result is not response: if result is not response:
response.setBody(result) response.setBody(result)
endInteraction()
notify(PubBeforeCommit(request)) notify(PubBeforeCommit(request))
return response return response
......
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