from django.utils import simplejson
from django.utils.importlib import import_module
-from social_auth.utils import setting, log, model_to_ctype, ctype_to_model, DSAException
+from social_auth.utils import setting, log, model_to_ctype, ctype_to_model
+from social_auth.backends.exceptions import DSAException
from social_auth.store import DjangoOpenIDStore
from social_auth.backends.exceptions import StopPipeline
+# coding=utf-8
+
class StopPipeline(Exception):
"""Stop pipeline process exception.
Raise this exception to stop the rest of the pipeline process.
"""
pass
+
+
+class DSAException(ValueError):
+ """
+ django-social-auth exception. This exception can be showed to user. It is thrown in normal situations – user declined
+ access, access token expired, etc.
+ """
+ pass
\ No newline at end of file
from django.db.utils import IntegrityError
+from django.utils.translation import ugettext
from social_auth.utils import setting
from social_auth.models import UserSocialAuth
from social_auth.backends.pipeline import warn_setting
+from social_auth.backends.exceptions import DSAException
def social_auth_user(backend, uid, user=None, *args, **kwargs):
if social_user:
if user and social_user.user != user:
- raise ValueError('Account already in use.', social_user)
+ raise DSAException(ugettext('This %(provider)s account already in use.') % {
+ 'provider':backend.name,
+ })
elif not user:
user = social_user.user
return {'social_user': social_user, 'user': user}
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-02-16 21:41+0400\n"
+"POT-Creation-Date: 2012-02-17 15:25+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
-"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
-#: build/lib/social_auth/views.py:70 social_auth/views.py:70
+#: views.py:71
msgid "Unknown authentication error. Try again later."
msgstr "Непредвиденная ошибка аутентификации. Попробуйте позже."
-#: build/lib/social_auth/backends/__init__.py:634
-#: build/lib/social_auth/backends/__init__.py:655
-#: social_auth/backends/__init__.py:634 social_auth/backends/__init__.py:655
+#: backends/__init__.py:635 backends/__init__.py:656
msgid "Authentication process was cancelled"
msgstr "Процесс аутентификации был прерван"
-#: build/lib/social_auth/backends/__init__.py:636
-#: build/lib/social_auth/backends/__init__.py:657
-#: social_auth/backends/__init__.py:636 social_auth/backends/__init__.py:657
+#: backends/__init__.py:637 backends/__init__.py:658
#, python-format
msgid "Authentication failed: %s"
msgstr "Ошибка аутентификации: %s"
+
+#: backends/pipeline/social.py:25
+#, python-format
+msgid "This %(provider)s account already in use."
+msgstr "Этот аккаунт %(provider)s уже используется."
redirect_page = content
url = REDIRECT_RE.findall(redirect_page)
+ print redirect_page
self.assertTrue(url)
# URL comes on JS scaped, needs to be clean first, any better way?
url = url[0].replace('\u0025', '%').replace('\\', '')
from django.db.models import Model
from django.contrib.contenttypes.models import ContentType
-class DSAException(ValueError):
- """
- django-social-auth exception. This exception can be showed to user. It is thrown in normal situations – user declined
- access, access token expired, etc.
- """
- pass
-
def sanitize_log_data(secret, data=None, leave_characters=4):
"""
from django.views.decorators.csrf import csrf_exempt
from social_auth.backends import get_backend
-from social_auth.utils import sanitize_redirect, setting, log, DSAException
+from social_auth.utils import sanitize_redirect, setting, log
+from social_auth.backends.exceptions import DSAException
DEFAULT_REDIRECT = setting('SOCIAL_AUTH_LOGIN_REDIRECT_URL') or \