[Checkins] SVN: zope.publisher/trunk/ merge lp:~lifeless/zope.publisher/start-request-event

Gary Poster gary.poster at canonical.com
Thu Jul 15 11:00:01 EDT 2010


Log message for revision 114781:
  merge lp:~lifeless/zope.publisher/start-request-event

Changed:
  U   zope.publisher/trunk/CHANGES.txt
  U   zope.publisher/trunk/src/zope/publisher/interfaces/__init__.py

-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt	2010-07-15 14:34:26 UTC (rev 114780)
+++ zope.publisher/trunk/CHANGES.txt	2010-07-15 15:00:00 UTC (rev 114781)
@@ -6,6 +6,10 @@
 
 - LP #131460: Make principal logging unicode safe.
 - Remove use of string exceptions in tests, http://bugs.debian.org/585343
+- Add IStartRequestEvent and StartRequestEvent for using in
+  zope.app.publication (matching up with IEndRequestEvent and EndRequestEvent).
+  This included refactoring to produce one definition of 'event with a request'
+  - IRequestEvent.
 
 3.12.3 (2010-04-30)
 -------------------

Modified: zope.publisher/trunk/src/zope/publisher/interfaces/__init__.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/interfaces/__init__.py	2010-07-15 14:34:26 UTC (rev 114780)
+++ zope.publisher/trunk/src/zope/publisher/interfaces/__init__.py	2010-07-15 15:00:00 UTC (rev 114781)
@@ -463,20 +463,46 @@
     """
 
 
-class IEndRequestEvent(Interface):
-    """An event which gets sent when the publication is ended"""
+class IRequestEvent(Interface):
+    """An event which is about or for a request."""
 
+    request = Attribute("The request this event is about.")
 
-class EndRequestEvent(object):
+
+class IEndRequestEvent(IRequestEvent):
+    """An event which gets sent when the publication is ended."""
+
+
+class IStartRequestEvent(IRequestEvent):
+    """An event which gets sent before publication of a request."""
+
+
+class RequestEvent(object):
+    """Events for requests.
+    
+    :ivar request: The request the event is for.
+    """
+
+    def __init__(self, request):
+        self.request = request
+
+
+class EndRequestEvent(RequestEvent):
     """An event which gets sent when the publication is ended"""
 
     implements(IEndRequestEvent)
 
     def __init__(self, ob, request):
+        super(EndRequestEvent, self).__init__(request)
         self.object = ob
-        self.request = request
 
 
+class StartRequestEvent(RequestEvent):
+    """An event send when before publication of a request."""
+
+    implements(IStartRequestEvent)
+
+
 class ISkinType(IInterface):
     """Base interface for skin types."""
 
@@ -497,13 +523,11 @@
     """
 
 
-class ISkinChangedEvent(Interface):
+class ISkinChangedEvent(IRequestEvent):
     """Event that gets triggered when the skin of a request is changed."""
 
-    request = Attribute("The request for which the skin was changed.")
 
 
-
 class IDefaultViewName(Interface):
     """A string that contains the default view name
 



More information about the checkins mailing list