]> git.parisson.com Git - django-social-auth.git/commitdiff
Logging update to use log function from utils, Facebook documentation update for...
authorStas Kravets <krvss@mail.ru>
Wed, 9 May 2012 12:03:49 +0000 (16:03 +0400)
committerStas Kravets <krvss@mail.ru>
Wed, 9 May 2012 12:03:49 +0000 (16:03 +0400)
doc/backends/facebook.rst
social_auth/backends/contrib/mailru.py
social_auth/backends/contrib/odnoklassniki.py
social_auth/backends/contrib/vkontakte.py
social_auth/backends/contrib/yandex.py

index 098d04c2df3aed797d63be1ade8286d5df94956f..b7df58d2b05865c14361376f7df6939cd9fdb2e8 100644 (file)
@@ -32,7 +32,10 @@ http://127.0.0.1:8000 or http://localhost:8000 because it won't work when
 testing. Instead I define http://myapp.com and setup a mapping on /etc/hosts
 or use dnsmasq_.
 
+If you need to perform authentication from Facebook Canvas application, take a
+look to `Facebook Canvas Application Authentication`_.
 
 .. _dnsmasq: http://www.thekelleys.org.uk/dnsmasq/doc.html
 .. _Facebook development resources: http://developers.facebook.com/docs/authentication/
 .. _Facebook App Creation: http://developers.facebook.com/setup/
+.. _Facebook Canvas Application Authentication: http://www.ikrvss.ru/2011/09/22/django-social-auth-and-facebook-canvas-applications/
\ No newline at end of file
index 9855a760ba4ae160f02efdf5669929799e5fcf6a..57943037ca155ca5b34959b93c2640ebf542b85b 100644 (file)
@@ -10,9 +10,6 @@ Then update your settings values using registration information
 
 """
 
-import logging
-logger = logging.getLogger(__name__)
-
 from django.conf import settings
 from django.utils import simplejson
 
@@ -21,7 +18,7 @@ from urllib2 import Request, urlopen, HTTPError
 from hashlib import md5
 
 from social_auth.backends import OAuthBackend, BaseOAuth2, USERNAME
-from social_auth.utils import setting
+from social_auth.utils import setting, log
 
 MAILRU_API_URL       = 'http://www.appsmail.ru/platform/api'
 MAILRU_OAUTH2_SCOPE  = ['']
@@ -91,7 +88,7 @@ def mailru_api(data):
     try:
         return simplejson.loads(urlopen(request).read())
     except (TypeError, KeyError, IOError, ValueError, IndexError):
-        logger.error('Could not load data from Mail.ru.', exc_info=True, extra=dict(data=params))
+        log('error', 'Could not load data from Mail.ru.', exc_info=True, extra=dict(data=params))
         return None
     
 
index aa3a29ba850803e5ba1285bbbf1d6a2869a0a2db..25d271b2edee275bb83ac1db58f765cd6a9cf449 100644 (file)
@@ -11,9 +11,6 @@ mail to set settings values
 
 """
 
-import logging
-logger = logging.getLogger(__name__)
-
 from django.conf import settings
 from django.utils import simplejson
 
@@ -22,7 +19,7 @@ from urllib2 import Request, urlopen
 from hashlib import md5
 
 from social_auth.backends import OAuthBackend, BaseOAuth2, USERNAME
-from social_auth.utils import setting
+from social_auth.utils import setting, log
 
 ODNOKLASSNIKI_API_URL       = 'http://api.odnoklassniki.ru/fb.do'
 ODNOKLASSNIKI_OAUTH2_SCOPE  = [''] # Enough for authentication
@@ -84,7 +81,7 @@ def odnoklassniki_api(data):
     try:
         return simplejson.loads(urlopen(request).read())
     except (TypeError, KeyError, IOError, ValueError, IndexError):
-        logger.error('Could not load data from Odnoklassniki.', exc_info=True, extra=dict(data=params))
+        log('error', 'Could not load data from Odnoklassniki.', exc_info=True, extra=dict(data=params))
         return None
 
 # Backend definition
index c23747c1e800276fd0a396dda7f2f898e1580c59..0e4ad2a4e01cf95ea3b984822ce84a164d23e5ac 100644 (file)
@@ -5,9 +5,6 @@ This contribution adds support for VKontakte OpenAPI and OAuth 2.0 service in th
 www.vkontakte.ru. Username is retrieved from the identity returned by server.
 """
 
-import logging
-logger = logging.getLogger(__name__)
-
 from django.contrib.auth import authenticate
 from django.utils import simplejson
 
@@ -17,7 +14,7 @@ from hashlib import md5
 from time import time
 
 from social_auth.backends import SocialAuthBackend, OAuthBackend, BaseAuth, BaseOAuth2, USERNAME
-from social_auth.utils import setting
+from social_auth.utils import setting, log
 
 # Vkontakte configuration
 VK_AUTHORIZATION_URL = 'http://oauth.vk.com/authorize'
@@ -246,7 +243,7 @@ def vkontakte_api(method, data):
     try:
         return simplejson.load(urlopen(url))
     except (TypeError, KeyError, IOError, ValueError, IndexError):
-        logger.error('Could not load data from VKontakte.', exc_info=True, extra=dict(data=data))
+        log('error', 'Could not load data from VKontakte.', exc_info=True, extra=dict(data=data))
         return None
 
 # Backend definition
index edd6477f8c5ff3b94b00fd372c7610949daf8680..7f519f19bce7131463638de62311c3fb967a7edf 100644 (file)
@@ -6,11 +6,8 @@ openid.yandex.ru/user. Username is retrieved from the identity url.
 
 If username is not specified, OpenID 2.0 url used for authentication.
 """
-import logging
 from django.utils import simplejson
 
-logger = logging.getLogger(__name__)
-
 from urllib import urlencode, unquote
 from urllib2 import urlopen
 from urlparse import urlparse, urlsplit
@@ -18,7 +15,7 @@ from urlparse import urlparse, urlsplit
 from social_auth.backends import OpenIDBackend, OpenIdAuth, USERNAME,\
     OAuthBackend, BaseOAuth2
 
-from social_auth.utils import setting
+from social_auth.utils import setting, log
 
 # Yandex configuration
 YANDEX_AUTHORIZATION_URL = 'https://oauth.yandex.ru/authorize'
@@ -113,7 +110,7 @@ class YaruAuth(BaseOAuth2):
         try:
             return simplejson.load(urlopen(url))
         except (ValueError, IndexError):
-            logger.error('Could not load data from Yandex.', exc_info=True, extra=dict(data=params))
+            log('error', 'Could not load data from Yandex.', exc_info=True, extra=dict(data=params))
             return None