From: Matías Aguirre Date: Tue, 14 Feb 2012 14:33:02 +0000 (-0200) Subject: Raise exceptions setting. Closes #248. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=5c226ea2d51632a8debd144c4ea9e7a855c522ba;p=django-social-auth.git Raise exceptions setting. Closes #248. --- diff --git a/README.rst b/README.rst index c975e57..1ddff62 100644 --- a/README.rst +++ b/README.rst @@ -350,6 +350,15 @@ Configuration Defaults to ``LOGIN_ERROR_URL``. +- The app catches any exception and logs errors to ``logger`` or + ``django.contrib.messagess`` app. Having tracebacks is really useful when + debugging, for that purpose this setting was defined:: + + SOCIAL_AUTH_RAISE_EXCEPTIONS = DEBUG + + It's default value is ``DEBUG``, so you need to set it to ``False`` to avoid + tracebacks when ``DEBUG = True``. + ----------------------- Authentication Pipeline diff --git a/doc/configuration.rst b/doc/configuration.rst index c3cd344..3b01620 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -243,6 +243,14 @@ Configuration Defaults to ``LOGIN_ERROR_URL``. +- The app catches any exception and logs errors to ``logger`` or + ``django.contrib.messagess`` app. Having tracebacks is really useful when + debugging, for that purpose this setting was defined:: + + SOCIAL_AUTH_RAISE_EXCEPTIONS = DEBUG + + It's default value is ``DEBUG``, so you need to set it to ``False`` to avoid + tracebacks when ``DEBUG = True``. .. _Model Manager: http://docs.djangoproject.com/en/dev/topics/db/managers/#managers .. _Login URL: http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#login-url diff --git a/social_auth/views.py b/social_auth/views.py index 29774a4..d3e2734 100644 --- a/social_auth/views.py +++ b/social_auth/views.py @@ -22,6 +22,7 @@ from social_auth.utils import sanitize_redirect, setting, log DEFAULT_REDIRECT = setting('SOCIAL_AUTH_LOGIN_REDIRECT_URL') or \ setting('LOGIN_REDIRECT_URL') LOGIN_ERROR_URL = setting('LOGIN_ERROR_URL', setting('LOGIN_URL')) +RAISE_EXCEPTIONS = setting('SOCIAL_AUTH_RAISE_EXCEPTIONS', setting('DEBUG')) def dsa_view(redirect_name=None): @@ -46,7 +47,7 @@ def dsa_view(redirect_name=None): try: return func(request, backend, *args, **kwargs) except Exception, e: # some error ocurred - if setting('DEBUG'): + if RAISE_EXCEPTIONS: raise backend_name = backend.AUTH_BACKEND.name