Skip to content

Commit

Permalink
Forward port c126486 from 2.13 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 24, 2012
1 parent de366b2 commit 30b54fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ZPublisher/WSGIPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -149,6 +150,7 @@ def __str__(self):
# return ''
raise NotImplementedError


def publish(request, module_name,
_get_module_info=get_module_info, # only for testing
):
Expand All @@ -160,8 +162,9 @@ def publish(request, module_name,
err_hook,
validated_hook,
transactions_manager,
)= _get_module_info(module_name)
) = _get_module_info(module_name)

notify(PubStart(request))
request.processInputs()
response = request.response

Expand All @@ -181,8 +184,9 @@ def publish(request, module_name,
# 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)
Expand All @@ -201,8 +205,10 @@ def publish(request, module_name,
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.
Expand Down

0 comments on commit 30b54fd

Please sign in to comment.