From 0c926d60b8df81f8ef1abbfb7ba00477dfa176a8 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Fri, 7 Mar 2014 17:31:20 +0100 Subject: [PATCH 1/2] oauth strip encoding part in content-type response from server. --- gluon/contrib/login_methods/oauth20_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/contrib/login_methods/oauth20_account.py b/gluon/contrib/login_methods/oauth20_account.py index e36d9229..4336a667 100644 --- a/gluon/contrib/login_methods/oauth20_account.py +++ b/gluon/contrib/login_methods/oauth20_account.py @@ -174,7 +174,7 @@ server for requests. It can be used for the optional"scope" parameters for Face data = open_url.read() resp_type = open_url.info().get('Content-Type') # try json style first - if not resp_type or resp_type == 'application/json': + if not resp_type or resp_type[:16] == 'application/json': try: tokendata = json.loads(data) current.session.token = tokendata From 55b92e854c184ecc8f2972429e2f51688b6bfda1 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Fri, 7 Mar 2014 18:01:41 +0100 Subject: [PATCH 2/2] use mimemessage method gettype() to extract content-type --- gluon/contrib/login_methods/oauth20_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/contrib/login_methods/oauth20_account.py b/gluon/contrib/login_methods/oauth20_account.py index 4336a667..632244d9 100644 --- a/gluon/contrib/login_methods/oauth20_account.py +++ b/gluon/contrib/login_methods/oauth20_account.py @@ -172,7 +172,7 @@ server for requests. It can be used for the optional"scope" parameters for Face if open_url: try: data = open_url.read() - resp_type = open_url.info().get('Content-Type') + resp_type = open_url.info().gettype() # try json style first if not resp_type or resp_type[:16] == 'application/json': try: