Merge lp:~lifeless/zope.publisher/start-request-event into lp:zope.publisher

Proposed by Robert Collins
Status: Merged
Merge reported by: Robert Collins
Merged at revision: not available
Proposed branch: lp:~lifeless/zope.publisher/start-request-event
Merge into: lp:zope.publisher
Diff against target: 82 lines (+37/-9)
2 files modified
CHANGES.txt (+4/-0)
src/zope/publisher/interfaces/__init__.py (+33/-9)
To merge this branch: bzr merge lp:~lifeless/zope.publisher/start-request-event
Reviewer Review Type Date Requested Status
ZTK steering group Pending
Review via email: mp+28558@code.launchpad.net

Description of the change

EndRequest events are nice, StartRequest events would be nice too. As tested as EndRequest (that is not at all :().

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :
Revision history for this message
Tres Seaver (tseaver) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> Robert Collins has proposed merging lp:~lifeless/zope.publisher/start-request-event into lp:zope.publisher.
>
> Requested reviews:
> ZTK steering group (ztk-steering-group)
>
>
> EndRequest events are nice, StartRequest events would be nice too. As tested as EndRequest (that is not at all :().
>

 +1

I presume that there is a correlated branch for zope.app.publication
which actually emits the new events.

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkwmEkkACgkQ+gerLs4ltQ6z0gCgg5ZR0umpljBYIUgcdKTFKMc+
vyUAn0bo4rhrdB310cj9U+jtOgMkeFkl
=1DXE
-----END PGP SIGNATURE-----

Revision history for this message
Robert Collins (lifeless) wrote :

There would be but I couldn't find a bzr import of zope.app.publication, so I've done a regular patch, filed a bug for zope.app.publication and filed it at https://bugs.edge.launchpad.net/zope.app.publication/+bug/598816.

Revision history for this message
Robert Collins (lifeless) wrote :

Benji says this has been applied.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES.txt'
2--- CHANGES.txt 2010-06-10 05:26:47 +0000
3+++ CHANGES.txt 2010-06-26 12:34:24 +0000
4@@ -6,6 +6,10 @@
5
6 - LP #131460: Make principal logging unicode safe.
7 - Remove use of string exceptions in tests, http://bugs.debian.org/585343
8+- Add IStartRequestEvent and StartRequestEvent for using in
9+ zope.app.publication (matching up with IEndRequestEvent and EndRequestEvent).
10+ This included refactoring to produce one definition of 'event with a request'
11+ - IRequestEvent.
12
13 3.12.3 (2010-04-30)
14 -------------------
15
16=== modified file 'src/zope/publisher/interfaces/__init__.py'
17--- src/zope/publisher/interfaces/__init__.py 2010-06-03 16:27:40 +0000
18+++ src/zope/publisher/interfaces/__init__.py 2010-06-26 12:34:24 +0000
19@@ -463,18 +463,44 @@
20 """
21
22
23-class IEndRequestEvent(Interface):
24- """An event which gets sent when the publication is ended"""
25-
26-
27-class EndRequestEvent(object):
28+class IRequestEvent(Interface):
29+ """An event which is about or for a request."""
30+
31+ request = Attribute("The request this event is about.")
32+
33+
34+class IEndRequestEvent(IRequestEvent):
35+ """An event which gets sent when the publication is ended."""
36+
37+
38+class IStartRequestEvent(IRequestEvent):
39+ """An event which gets sent before publication of a request."""
40+
41+
42+class RequestEvent(object):
43+ """Events for requests.
44+
45+ :ivar request: The request the event is for.
46+ """
47+
48+ def __init__(self, request):
49+ self.request = request
50+
51+
52+class EndRequestEvent(RequestEvent):
53 """An event which gets sent when the publication is ended"""
54
55 implements(IEndRequestEvent)
56
57 def __init__(self, ob, request):
58+ super(EndRequestEvent, self).__init__(request)
59 self.object = ob
60- self.request = request
61+
62+
63+class StartRequestEvent(RequestEvent):
64+ """An event send when before publication of a request."""
65+
66+ implements(IStartRequestEvent)
67
68
69 class ISkinType(IInterface):
70@@ -497,11 +523,9 @@
71 """
72
73
74-class ISkinChangedEvent(Interface):
75+class ISkinChangedEvent(IRequestEvent):
76 """Event that gets triggered when the skin of a request is changed."""
77
78- request = Attribute("The request for which the skin was changed.")
79-
80
81
82 class IDefaultViewName(Interface):

Subscribers

People subscribed via source and target branches