[Checkins] SVN: z3ext.cacheheaders/trunk/ - Added AfterExceptionCallEvent event

Nikolay Kim fafhrd91 at gmail.com
Tue Nov 24 21:31:15 EST 2009


Log message for revision 105999:
  - Added AfterExceptionCallEvent event

Changed:
  U   z3ext.cacheheaders/trunk/CHANGES.txt
  U   z3ext.cacheheaders/trunk/setup.py
  U   z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py
  U   z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py

-=-
Modified: z3ext.cacheheaders/trunk/CHANGES.txt
===================================================================
--- z3ext.cacheheaders/trunk/CHANGES.txt	2009-11-24 21:52:57 UTC (rev 105998)
+++ z3ext.cacheheaders/trunk/CHANGES.txt	2009-11-25 02:31:15 UTC (rev 105999)
@@ -2,10 +2,12 @@
 CHANGES
 =======
 
-1.1.2 (Unreleased)
+1.2.0 (2009-11-24)
 ------------------
 
+- Added AfterExceptionCallEvent event
 
+
 1.1.1 (2009-08-28)
 ------------------
 

Modified: z3ext.cacheheaders/trunk/setup.py
===================================================================
--- z3ext.cacheheaders/trunk/setup.py	2009-11-24 21:52:57 UTC (rev 105998)
+++ z3ext.cacheheaders/trunk/setup.py	2009-11-25 02:31:15 UTC (rev 105999)
@@ -21,7 +21,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version = '1.1.2dev'
+version = '0'
 
 
 setup(name='z3ext.cacheheaders',

Modified: z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py	2009-11-24 21:52:57 UTC (rev 105998)
+++ z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py	2009-11-25 02:31:15 UTC (rev 105999)
@@ -33,6 +33,20 @@
         self.request = request
 
 
+class IAfterExceptionCallEvent(IObjectEvent):
+    """ after call event """
+
+    request = interface.Attribute('Request')
+
+
+class AfterExceptionCallEvent(object):
+    interface.implements(IAfterExceptionCallEvent)
+
+    def __init__(self, object, request):
+        self.object = object
+        self.request = request
+
+
 class IModificationInfo(interface.Interface):
 
     def modified():

Modified: z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py	2009-11-24 21:52:57 UTC (rev 105998)
+++ z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py	2009-11-25 02:31:15 UTC (rev 105999)
@@ -33,7 +33,7 @@
 from zope.app.publication.interfaces import IBrowserRequestFactory
 from zope.app.publication.interfaces import IRequestPublicationFactory
 
-from interfaces import ICacheStrategy, AfterCallEvent
+from interfaces import ICacheStrategy, AfterCallEvent, AfterExceptionCallEvent
 
 
 class BrowserPublication(browser.BrowserPublication):
@@ -71,7 +71,17 @@
 
         return super(BrowserPublication, self).afterCall(request, ob)
 
+    def handleException(self, object, request, exc_info, retry_allowed=True):
+        super(BrowserPublication, self).handleException(
+            object, request, exc_info, retry_allowed)
 
+        orig = removeAllProxies(object)
+        if type(orig) is MethodType:
+            notify(AfterExceptionCallEvent(orig.im_self, request))
+        else:
+            notify(AfterExceptionCallEvent(orig, request))
+        
+
 class BrowserFactory(object):
     interface.implements(IRequestPublicationFactory)
 



More information about the checkins mailing list