]> git.openstreetmap.org Git - osqa.git/blobdiff - forum_modules/oauthauth/authentication.py
Adds a new function in the profile menu for admins to suspend users, indefinetly...
[osqa.git] / forum_modules / oauthauth / authentication.py
old mode 100755 (executable)
new mode 100644 (file)
index cfe8156..93cdc59
@@ -1,41 +1,41 @@
-from consumer import OAuthAbstractAuthConsumer\r
-from forum.authentication.base import ConsumerTemplateContext\r
-\r
-try:\r
-    import json as simplejson\r
-except ImportError:\r
-    from django.utils import simplejson\r
-\r
-from lib import oauth\r
-import settings\r
-\r
-class TwitterAuthConsumer(OAuthAbstractAuthConsumer):\r
-    def __init__(self):\r
-        OAuthAbstractAuthConsumer.__init__(self,\r
-                settings.TWITTER_CONSUMER_KEY,\r
-                settings.TWITTER_CONSUMER_SECRET,\r
-                "twitter.com",\r
-                "https://twitter.com/oauth/request_token",\r
-                "https://twitter.com/oauth/access_token",\r
-                "https://twitter.com/oauth/authorize",\r
-        )\r
-\r
-    def get_user_data(self, key):\r
-        json = self.fetch_data(key, "https://twitter.com/account/verify_credentials.json")\r
-        \r
-        if 'screen_name' in json:\r
-            creds = simplejson.loads(json)\r
-\r
-            return {\r
-                'username': creds['screen_name']\r
-            }\r
-        \r
-        \r
-        return {}\r
-\r
-class TwitterAuthContext(ConsumerTemplateContext):\r
-    mode = 'BIGICON'\r
-    type = 'DIRECT'\r
-    weight = 150\r
-    human_name = 'Twitter'\r
+from consumer import OAuthAbstractAuthConsumer
+from forum.authentication.base import ConsumerTemplateContext
+
+try:
+    import json as simplejson
+except ImportError:
+    from django.utils import simplejson
+
+from lib import oauth
+import settings
+
+class TwitterAuthConsumer(OAuthAbstractAuthConsumer):
+    def __init__(self):
+        OAuthAbstractAuthConsumer.__init__(self,
+                str(settings.TWITTER_CONSUMER_KEY),
+                str(settings.TWITTER_CONSUMER_SECRET),
+                "twitter.com",
+                "https://twitter.com/oauth/request_token",
+                "https://twitter.com/oauth/access_token",
+                "https://twitter.com/oauth/authorize",
+        )
+
+    def get_user_data(self, key):
+        json = self.fetch_data(key, "https://twitter.com/account/verify_credentials.json")
+        
+        if 'screen_name' in json:
+            creds = simplejson.loads(json)
+
+            return {
+                'username': creds['screen_name']
+            }
+        
+        
+        return {}
+
+class TwitterAuthContext(ConsumerTemplateContext):
+    mode = 'BIGICON'
+    type = 'DIRECT'
+    weight = 150
+    human_name = 'Twitter'
     icon = '/media/images/openid/twitter.png'
\ No newline at end of file