summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cramer <dcramer@gmail.com>2012-07-04 14:08:30 +0200
committerDavid Cramer <dcramer@gmail.com>2012-07-04 14:08:30 +0200
commit2ca52a31c2b857dbf396c32b567ee3afe839eb44 (patch)
treefb46d524f05a5dd80f7cacf0ea4ae05a4cc78095
parent19a2826b049e3cfbae31dd3711b9787c93776259 (diff)
downloadraven-2ca52a31c2b857dbf396c32b567ee3afe839eb44.tar.gz
Improve SentryWorker middleware
-rw-r--r--raven/contrib/async.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/raven/contrib/async.py b/raven/contrib/async.py
index 0b343ae..4f83c57 100644
--- a/raven/contrib/async.py
+++ b/raven/contrib/async.py
@@ -97,11 +97,10 @@ class SentryWorker(object):
>>> from raven.base import Client
>>> application = SentryWorker(application)
"""
- def __init__(self, application):
+ def __init__(self, application, worker=None):
self.application = application
- self.worker = AsyncWorker()
+ self.worker = worker or AsyncWorker()
def __call__(self, environ, start_response):
environ['raven.worker'] = self.worker
- for event in self.application(environ, start_response):
- yield event
+ return iter(self.application(environ, start_response))