From 49304cecdf2c51888ee4ff42ec6496207186ad9b Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 2 Nov 2009 12:23:26 +0000 Subject: - Add a new event type: ``repoze.bfg.events.AfterTraversal``. Events of this type will be sent after traversal is completed, but before any view code is invoked. Like ``repoze.bfg.events.NewRequest``, This event will have a single attribute: ``request`` representing the current request. Unlike the request attribute of ``repoze.bfg.events.NewRequest`` however, during an AfterTraversal event, the request object will possess attributes set by the traverser, most notably ``context``, which will be the context used when a view is found and invoked. The interface ``repoze.bfg.events.IAfterTraversal`` can be used to subscribe to the event. For example:: Like any framework event, a subscriber function should expect one parameter: ``event``. --- repoze/bfg/interfaces.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 53b01bfd6..582e8984d 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -120,6 +120,11 @@ class IRouter(Interface): registry = Attribute( """Component architecture registry local to this application.""") +class IAfterTraversal(Interface): + """ An event type that is emitted after repoze.bfg completes + traversal but before it calls any view code.""" + request = Attribute('The request object') + class INewRequest(Interface): """ An event type that is emitted whenever repoze.bfg begins to process a new request """ -- cgit v1.2.3