]> git.parisson.com Git - django-social-auth.git/commitdiff
Raise exceptions setting. Closes #248.
authorMatías Aguirre <matiasaguirre@gmail.com>
Tue, 14 Feb 2012 14:33:02 +0000 (12:33 -0200)
committerMatías Aguirre <matiasaguirre@gmail.com>
Tue, 14 Feb 2012 14:33:09 +0000 (12:33 -0200)
README.rst
doc/configuration.rst
social_auth/views.py

index c975e57d3c7bc2845dc2ff66e63d5f9b6a722572..1ddff62492065e5f71f72fef7d9536d40b1dfbd1 100644 (file)
@@ -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
index c3cd3449f576e9b9984f1e06f470153f71b611b8..3b016201bcfc6fb6850ce0aef00fd1d8d6adae14 100644 (file)
@@ -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
index 29774a4fe3bdd163839869af2956d8d2cd716c9b..d3e273467a0777ef4d3ffccaf99f5c2ef45569a5 100644 (file)
@@ -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