diff options
Diffstat (limited to 'repoze/bfg/events.py')
| -rw-r--r-- | repoze/bfg/events.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/repoze/bfg/events.py b/repoze/bfg/events.py index 54f60c294..14e47ca3f 100644 --- a/repoze/bfg/events.py +++ b/repoze/bfg/events.py @@ -1,5 +1,6 @@ from zope.interface import implements +from repoze.bfg.interfaces import IAfterTraversal from repoze.bfg.interfaces import INewRequest from repoze.bfg.interfaces import INewResponse from repoze.bfg.interfaces import IWSGIApplicationCreatedEvent @@ -23,6 +24,20 @@ class NewResponse(object): def __init__(self, response): self.response = response +class AfterTraversal(object): + implements(IAfterTraversal) + """ An instance of this class is emitted as an event after the + repoze.bfg router performs traversal (but before any view code is + executed). The instance has an attribute, ``request``, which is + the request object returned by the view. Notably, the request + object will have an attribute named ``context``, which is the + context that will be provided to the view which will eventually be + called, as well as other attributes defined by the traverser. + This class implements the + ``repoze.bfg.interfaces.IAfterTraversal`` interface.""" + def __init__(self, request): + self.request = request + class WSGIApplicationCreatedEvent(object): """ An instance of this class is emitted as an event whenever a ``repoze.bfg`` application starts. The instance has an attribute, @@ -32,7 +47,5 @@ class WSGIApplicationCreatedEvent(object): implements(IWSGIApplicationCreatedEvent) def __init__(self, app): self.app = app + self.object = app - @property - def object(self): - return self.app |
