[Zope-Checkins] SVN: Zope/branches/2.13/ Added PubStart, PubBeforeCommit and PubAfterTraversal events to the WSGI publisher.
Hano Schlichting
cvs-admin at zope.org
Thu May 24 16:18:53 UTC 2012
Log message for revision 126486:
Added PubStart, PubBeforeCommit and PubAfterTraversal events to the WSGI publisher.
Changed:
U Zope/branches/2.13/doc/CHANGES.rst
U Zope/branches/2.13/src/ZPublisher/WSGIPublisher.py
-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst 2012-05-24 14:34:07 UTC (rev 126485)
+++ Zope/branches/2.13/doc/CHANGES.rst 2012-05-24 16:18:50 UTC (rev 126486)
@@ -8,6 +8,9 @@
2.13.14 (unreleased)
--------------------
+- Added PubStart, PubBeforeCommit and PubAfterTraversal events to the
+ WSGI publisher.
+
- ZPublisher: Fixed a traversal regression introduced in 2.13.12.
- Updated distributions:
Modified: Zope/branches/2.13/src/ZPublisher/WSGIPublisher.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/WSGIPublisher.py 2012-05-24 14:34:07 UTC (rev 126485)
+++ Zope/branches/2.13/src/ZPublisher/WSGIPublisher.py 2012-05-24 16:18:50 UTC (rev 126486)
@@ -30,6 +30,7 @@
from ZPublisher.Publish import dont_publish_class
from ZPublisher.Publish import get_module_info
from ZPublisher.Publish import missing_name
+from ZPublisher.pubevents import PubStart, PubBeforeCommit, PubAfterTraversal
from ZPublisher.Iterators import IStreamIterator
_NOW = None # overwrite for testing
@@ -149,6 +150,7 @@
# return ''
raise NotImplementedError
+
def publish(request, module_name,
_get_module_info=get_module_info, # only for testing
):
@@ -160,8 +162,9 @@
err_hook,
validated_hook,
transactions_manager,
- )= _get_module_info(module_name)
+ ) = _get_module_info(module_name)
+ notify(PubStart(request))
request.processInputs()
response = request.response
@@ -181,8 +184,9 @@
# According to RFC1738 a trailing space in the path is valid.
path = request.get('PATH_INFO')
- request['PARENTS'] = parents = [object]
+ request['PARENTS'] = [object]
object = request.traverse(path, validated_hook=validated_hook)
+ notify(PubAfterTraversal(request))
if transactions_manager:
transactions_manager.recordMetaData(object, request)
@@ -201,8 +205,10 @@
if result is not response:
response.setBody(result)
+ notify(PubBeforeCommit(request))
return response
+
class _RequestCloserForTransaction(object):
"""Unconditionally close the request at the end of a transaction.
More information about the Zope-Checkins
mailing list