summaryrefslogtreecommitdiff
path: root/repoze/bfg/events.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-07-31 06:17:31 +0000
committerChris McDonough <chrism@agendaless.com>2008-07-31 06:17:31 +0000
commita0423aedb4abaf12b4008c0b229ec0ecad4ddfd8 (patch)
tree6193a7bce3bdb05c6c9e81921d592b769cd071b1 /repoze/bfg/events.py
parent54302499c5ff609b4c615a7ae1d341e7d652dae3 (diff)
downloadpyramid-a0423aedb4abaf12b4008c0b229ec0ecad4ddfd8.tar.gz
pyramid-a0423aedb4abaf12b4008c0b229ec0ecad4ddfd8.tar.bz2
pyramid-a0423aedb4abaf12b4008c0b229ec0ecad4ddfd8.zip
- Add event sends for INewRequest and INewResponse. See the
events.rst chapter in the documentation's ``api`` directory.
Diffstat (limited to 'repoze/bfg/events.py')
-rw-r--r--repoze/bfg/events.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/repoze/bfg/events.py b/repoze/bfg/events.py
new file mode 100644
index 000000000..3253f1380
--- /dev/null
+++ b/repoze/bfg/events.py
@@ -0,0 +1,23 @@
+from zope.interface import implements
+
+from repoze.bfg.interfaces import INewRequest
+from repoze.bfg.interfaces import INewResponse
+
+class NewRequest(object):
+ """ An instance of this class is emitted as an event whenever
+ repoze.bfg begins to process a new request. The instance has an
+ attribute, ``request``, which is the request object. This class
+ implements the ``repoze.bfg.interfaces.INewRequest`` interface."""
+ implements(INewRequest)
+ def __init__(self, request):
+ self.request = request
+
+class NewResponse(object):
+ """ An instance of this class is emitted as an event whenever any
+ repoze.bfg view returns a response.. The instance has an
+ attribute, ``response``, which is the response object returned by
+ the view. This class implements the
+ ``repoze.bfg.interfaces.INewResponse`` interface."""
+ implements(INewResponse)
+ def __init__(self, response):
+ self.response = response