Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Register sentry namespace in app.extensions (Flask)

  • Loading branch information...
commit 0852cf5a96e23c982b410efd07b3e5b78b401356 1 parent 1563b4d
@dcramer dcramer authored
Showing with 10 additions and 0 deletions.
  1. +4 −0 raven/contrib/flask/__init__.py
  2. +6 −0 tests/contrib/flask/tests.py
View
4 raven/contrib/flask/__init__.py
@@ -95,6 +95,10 @@ def init_app(self, app):
got_request_exception.connect(self.handle_exception, sender=app)
+ if not hasattr(app, 'extensions'):
+ app.extensions = {}
+ app.extensions['sentry'] = self
+
def captureException(self, *args, **kwargs):
assert self.client, 'captureException called before application configured'
return self.client.captureException(*args, **kwargs)
View
6 tests/contrib/flask/tests.py
@@ -32,6 +32,12 @@ def setUp(self):
self.app = create_app()
self.client = self.app.test_client()
+ def test_does_add_to_extensions(self):
+ client = TempStoreClient()
+ sentry = Sentry(self.app, client=client)
+ self.assertIn('sentry', self.app.extensions)
+ self.assertEquals(self.app.extensions['sentry'], sentry)
+
def test_error_handler(self):
client = TempStoreClient()
sentry = Sentry(self.app, client=client)

0 comments on commit 0852cf5

Please sign in to comment.
Something went wrong with that request. Please try again.