[Checkins] SVN: ZPublisherEventsBackport/trunk/s New events from Zope 2.12.2 (unreleased right now)
Martin Aspeli
optilude at gmx.net
Fri Nov 13 03:00:29 EST 2009
Log message for revision 105591:
New events from Zope 2.12.2 (unreleased right now)
Changed:
U ZPublisherEventsBackport/trunk/setup.py
_U ZPublisherEventsBackport/trunk/src/
U ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/configure.zcml
U ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/interfaces.py
U ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/patch.py
U ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/pubevents.py
-=-
Modified: ZPublisherEventsBackport/trunk/setup.py
===================================================================
--- ZPublisherEventsBackport/trunk/setup.py 2009-11-13 06:42:23 UTC (rev 105590)
+++ ZPublisherEventsBackport/trunk/setup.py 2009-11-13 08:00:29 UTC (rev 105591)
@@ -25,6 +25,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
+ 'collective.monkeypatcher',
],
)
Property changes on: ZPublisherEventsBackport/trunk/src
___________________________________________________________________
Added: svn:ignore
+ *.egg-info
Modified: ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/configure.zcml
===================================================================
--- ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/configure.zcml 2009-11-13 06:42:23 UTC (rev 105590)
+++ ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/configure.zcml 2009-11-13 08:00:29 UTC (rev 105591)
@@ -1,3 +1,4 @@
-<configure xmlns="http://namespaces.zope.org/zope">
- <!-- Stub so configure phase may trigger patch -->
+<configure
+ xmlns="http://namespaces.zope.org/zope">
+
</configure>
Modified: ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/interfaces.py
===================================================================
--- ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/interfaces.py 2009-11-13 06:42:23 UTC (rev 105590)
+++ ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/interfaces.py 2009-11-13 08:00:29 UTC (rev 105591)
@@ -41,5 +41,12 @@
class IPubBeforeCommit(IPubEvent):
"""notified immediately before the transaction commit (i.e. after the main
- request processing is finished.
+ request processing is finished).
"""
+
+class IPubBeforeAbort(IPubEvent):
+ """notified immediately before the transaction abort (i.e. after the main
+ request processing is finished, and there was an error).
+ """
+ exc_info = Attribute('''The exception info as returned by 'sys.exc_info()'.''')
+ retry = Attribute('Whether the request will be retried')
Modified: ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/patch.py
===================================================================
--- ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/patch.py 2009-11-13 06:42:23 UTC (rev 105590)
+++ ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/patch.py 2009-11-13 08:00:29 UTC (rev 105591)
@@ -1,4 +1,3 @@
-import logging
import sys
from ZPublisher.Publish import call_object
from ZPublisher.Publish import missing_name
@@ -14,9 +13,8 @@
from zope.event import notify
from pubevents import PubStart, PubSuccess, PubFailure, \
- PubBeforeCommit, PubAfterTraversal
+ PubBeforeCommit, PubAfterTraversal, PubBeforeAbort
-
def publish(request, module_name, after_list, debug=0,
# Optimize:
call_object=call_object,
@@ -126,9 +124,12 @@
retry = True
finally:
# Note: 'abort's can fail. Nevertheless, we want end request handling
- try:
- if transactions_manager:
- transactions_manager.abort()
+ try:
+ try:
+ notify(PubBeforeAbort(request, exc_info, retry))
+ finally:
+ if transactions_manager:
+ transactions_manager.abort()
finally:
endInteraction()
notify(PubFailure(request, exc_info, retry))
@@ -148,10 +149,13 @@
else:
# Note: 'abort's can fail. Nevertheless, we want end request handling
- try:
- if transactions_manager:
- transactions_manager.abort()
+ try:
+ try:
+ notify(PubBeforeAbort(request, exc_info, False))
+ finally:
+ if transactions_manager:
+ transactions_manager.abort()
finally:
endInteraction()
- notify(PubFailure(request, exc_info, False))
+ notify(PubFailure(request, exc_info, retry))
raise
Modified: ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/pubevents.py
===================================================================
--- ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/pubevents.py 2009-11-13 06:42:23 UTC (rev 105590)
+++ ZPublisherEventsBackport/trunk/src/ZPublisherEventsBackport/pubevents.py 2009-11-13 08:00:29 UTC (rev 105591)
@@ -10,7 +10,7 @@
from zope.interface import implements
from interfaces import IPubStart, IPubSuccess, IPubFailure, \
- IPubAfterTraversal, IPubBeforeCommit
+ IPubAfterTraversal, IPubBeforeCommit, IPubBeforeAbort
class _Base(object):
"""PubEvent base class."""
@@ -42,3 +42,10 @@
class PubBeforeCommit(_Base):
"""notified immediately before the commit."""
implements(IPubBeforeCommit)
+
+class PubBeforeAbort(_Base):
+ """notified immediately before an abort."""
+ implements(IPubBeforeAbort)
+
+ def __init__(self, request, exc_info, retry):
+ self.request, self.exc_info, self.retry = request, exc_info, retry
More information about the checkins
mailing list