From f2d2eadc6ff07fd9d8fc83d144ccc1e82b5480c2 Mon Sep 17 00:00:00 2001 From: Johan Meiring Date: Wed, 3 Apr 2013 10:57:08 +0200 Subject: Corrects two additional documentation inconsistencies --- oauthlib/oauth2/draft25/grant_types.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oauthlib/oauth2/draft25/grant_types.py b/oauthlib/oauth2/draft25/grant_types.py index 4897d4c..4fd51f4 100644 --- a/oauthlib/oauth2/draft25/grant_types.py +++ b/oauthlib/oauth2/draft25/grant_types.py @@ -130,7 +130,7 @@ class RequestValidator(object): """Invalidate an authorization code after use. :param client_id: Unicode client identifier - :param code: A dict of the authorization code grant. + :param code: The authorization code grant (request.code). :param request: The HTTP Request (oauthlib.common.Request) Method is used by: @@ -178,11 +178,14 @@ class RequestValidator(object): 'token_type': 'Bearer', 'access_token': 'askfjh234as9sd8', 'expires_in': 3600, - 'scope': ['list', 'of', 'authorized', 'scopes'], + 'scope': 'string of space separated authorized scopes', 'refresh_token': '23sdf876234', # if issued 'state': 'given_by_client', # if supplied by client } + Note that while "scope" is a string-separated list of authorized scopes, + the original list is still available in request.scopes + :param client_id: Unicode client identifier :param token: A Bearer token dict :param request: The HTTP Request (oauthlib.common.Request) -- cgit v1.2.1 From 76e8bc7eff107000849f7428e469c70801680e3f Mon Sep 17 00:00:00 2001 From: Johan Meiring Date: Wed, 3 Apr 2013 14:47:17 +0200 Subject: Fixes decorators that were throwing errors --- oauthlib/oauth2/ext/django.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oauthlib/oauth2/ext/django.py b/oauthlib/oauth2/ext/django.py index f68f67f..3c2bee1 100644 --- a/oauthlib/oauth2/ext/django.py +++ b/oauthlib/oauth2/ext/django.py @@ -24,8 +24,10 @@ class OAuth2ProviderDecorator(object): uri = request.build_absolute_uri() http_method = request.method headers = request.META - del headers['wsgi.input'] - del headers['wsgi.errors'] + if 'wsgi.input' in headers: + del headers['wsgi.input'] + if 'wsgi.errors' in headers: + del headers['wsgi.errors'] if 'HTTP_AUTHORIZATION' in headers: headers['Authorization'] = headers['HTTP_AUTHORIZATION'] body = urlencode(request.POST.items()) @@ -86,7 +88,7 @@ class OAuth2ProviderDecorator(object): url, headers, body, status = self._token_endpoint.create_token_response( uri, http_method, body, headers, credentials) response = HttpResponse(content=body, status=status) - for k, v in headers: + for k, v in headers.iteritems(): response[k] = v return response return wrapper -- cgit v1.2.1 From f90a3bdb79bef5a39322c4d04c1055683ddcc15d Mon Sep 17 00:00:00 2001 From: Johan Meiring Date: Thu, 4 Apr 2013 08:31:03 +0200 Subject: Changes iteritems to items for Py3 compatibility --- oauthlib/oauth2/ext/django.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauthlib/oauth2/ext/django.py b/oauthlib/oauth2/ext/django.py index 3c2bee1..9c0e3e5 100644 --- a/oauthlib/oauth2/ext/django.py +++ b/oauthlib/oauth2/ext/django.py @@ -88,7 +88,7 @@ class OAuth2ProviderDecorator(object): url, headers, body, status = self._token_endpoint.create_token_response( uri, http_method, body, headers, credentials) response = HttpResponse(content=body, status=status) - for k, v in headers.iteritems(): + for k, v in headers.items(): response[k] = v return response return wrapper -- cgit v1.2.1