summaryrefslogtreecommitdiff
path: root/oauthlib/oauth2/ext/django.py
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2013-04-06 02:51:47 -0700
committerIb Lundgren <ib.lundgren@gmail.com>2013-04-06 02:51:47 -0700
commitbbe26bc46f6e2cf208050a476f6ad09f28bcc8e7 (patch)
tree7d58ca93d4494852c954d2065f68f0c420fbc10c /oauthlib/oauth2/ext/django.py
parent93654dcc583df0d7c3b32c922ab5b9fcb0289837 (diff)
parentf90a3bdb79bef5a39322c4d04c1055683ddcc15d (diff)
downloadoauthlib-bbe26bc46f6e2cf208050a476f6ad09f28bcc8e7.tar.gz
Merge pull request #132 from johanmeiring/master
Further documentation corrections
Diffstat (limited to 'oauthlib/oauth2/ext/django.py')
-rw-r--r--oauthlib/oauth2/ext/django.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/oauthlib/oauth2/ext/django.py b/oauthlib/oauth2/ext/django.py
index f68f67f..9c0e3e5 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.items():
response[k] = v
return response
return wrapper