Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new setting "SENTRY_TESTING" #7

Merged
1 commit merged into from
Sep 8, 2010
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ You can also use the ``exc_info`` and ``extra=dict(url=foo)`` arguments on your

logging.error('There was some crazy error', exc_info=sys.exc_info(), extra={'url': request.build_absolute_uri()})

##############
SENTRY_TESTING
##############

Enabling this setting allows the testing of Sentry exception handler even if Django DEBUG is enabled.

Default value is ``False``

.. note:: Normally when Django DEBUG is enabled the Sentry exception handler is immediately skipped

=====
Usage
=====
Expand Down
3 changes: 1 addition & 2 deletions sentry/client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import warnings

from django.conf import settings as dj_settings
from django.core.signals import got_request_exception
from django.db import transaction
from django.http import Http404
Expand All @@ -23,7 +22,7 @@ def sentry_exception_handler(sender, request=None, **kwargs):
and issubclass(exc_type, Http404):
return

if dj_settings.DEBUG or getattr(exc_type, 'skip_sentry', False):
if settings.DEBUG or getattr(exc_type, 'skip_sentry', False):
return

if transaction.is_dirty():
Expand Down
6 changes: 5 additions & 1 deletion sentry/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import logging

# Allow local testing of Sentry even if DEBUG is enabled
DEBUG = getattr(settings, 'DEBUG', False) and not getattr(settings, 'SENTRY_TESTING', False)

CATCH_404_ERRORS = getattr(settings, 'SENTRY_CATCH_404_ERRORS', False)

DATABASE_USING = getattr(settings, 'SENTRY_DATABASE_USING', None)
Expand Down Expand Up @@ -33,4 +36,5 @@
# This should be the full URL to sentries store view
REMOTE_URL = getattr(settings, 'SENTRY_REMOTE_URL', None)

REMOTE_TIMEOUT = getattr(settings, 'SENTRY_REMOTE_TIMEOUT', 5)
REMOTE_TIMEOUT = getattr(settings, 'SENTRY_REMOTE_TIMEOUT', 5)