From 8fb1a954ba189bb646b8db7a1e0184507ea55958 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Tue, 30 Jul 2013 23:24:01 +0200 Subject: [PATCH] oauth1 timeout. pbkdf2_ctypes repository reference in docstring --- gluon/contrib/login_methods/oauth10a_account.py | 5 +++-- gluon/contrib/pbkdf2_ctypes.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gluon/contrib/login_methods/oauth10a_account.py b/gluon/contrib/login_methods/oauth10a_account.py index f6cfeb0e..e25014da 100644 --- a/gluon/contrib/login_methods/oauth10a_account.py +++ b/gluon/contrib/login_methods/oauth10a_account.py @@ -109,7 +109,7 @@ class OAuthAccount(object): self.session.access_token = None return None - def __init__(self, g, client_id, client_secret, auth_url, token_url, access_token_url): + def __init__(self, g, client_id, client_secret, auth_url, token_url, access_token_url, socket_timeout=60): self.globals = g self.client_id = client_id self.client_secret = client_secret @@ -119,6 +119,7 @@ class OAuthAccount(object): self.auth_url = auth_url self.token_url = token_url self.access_token_url = access_token_url + self.socket_timeout = socket_timeout # consumer init self.consumer = oauth.Consumer(self.client_id, self.client_secret) @@ -154,7 +155,7 @@ class OAuthAccount(object): if not self.accessToken(): # setup the client - client = oauth.Client(self.consumer, None) + client = oauth.Client(self.consumer, None, timeout=self.socket_timeout) # Get a request token. # oauth_callback *is REQUIRED* for OAuth1.0a # putting it in the body seems to work. diff --git a/gluon/contrib/pbkdf2_ctypes.py b/gluon/contrib/pbkdf2_ctypes.py index 3627abed..cb220f6e 100644 --- a/gluon/contrib/pbkdf2_ctypes.py +++ b/gluon/contrib/pbkdf2_ctypes.py @@ -9,6 +9,8 @@ Note: This module is intended as a plugin replacement of pbkdf2.py by Armin Ronacher. + Git repository: + $ git clone https://github.com/michele-comitini/pbkdf2_ctypes.git :copyright: Copyright (c) 2013: Michele Comitini :license: LGPLv3 @@ -42,7 +44,7 @@ try: # check that we have proper OpenSSL on the system. hashlib.sha224: crypto.EVP_sha224, hashlib.sha384: crypto.EVP_sha384, hashlib.sha512: crypto.EVP_sha512} -except OSError, AttributeError: +except (OSError, AttributeError), e: raise ImportError('Cannot find a compatible OpenSSL installation ' 'on your system')