aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authentication.py
diff options
context:
space:
mode:
authorTom Christie2013-06-06 00:58:54 -0700
committerTom Christie2013-06-06 00:58:54 -0700
commitdb8d61196ad418b2fa471e5aca8788ca9eb0a091 (patch)
treef7f327b1d0a94bda0fced1ddd7c1932e85ca8b13 /rest_framework/authentication.py
parent4b96614b12aaba0ddf8f24dcdc4f8a06c3c194f7 (diff)
parentecb8a460c99238a959d8e7600af5b692f13c40d9 (diff)
downloaddjango-rest-framework-db8d61196ad418b2fa471e5aca8788ca9eb0a091.tar.bz2
Merge pull request #915 from aburgel/fix-oauth-bad-consumer-key
Fix serialization exception caused by non-existent consumer
Diffstat (limited to 'rest_framework/authentication.py')
-rw-r--r--rest_framework/authentication.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py
index 9caca788..f659a172 100644
--- a/rest_framework/authentication.py
+++ b/rest_framework/authentication.py
@@ -230,8 +230,9 @@ class OAuthAuthentication(BaseAuthentication):
try:
consumer_key = oauth_request.get_parameter('oauth_consumer_key')
consumer = oauth_provider_store.get_consumer(request, oauth_request, consumer_key)
- except oauth_provider.store.InvalidConsumerError as err:
- raise exceptions.AuthenticationFailed(err)
+ except oauth_provider.store.InvalidConsumerError:
+ msg = 'Invalid consumer token: %s' % oauth_request.get_parameter('oauth_consumer_key')
+ raise exceptions.AuthenticationFailed(msg)
if consumer.status != oauth_provider.consts.ACCEPTED:
msg = 'Invalid consumer key status: %s' % consumer.get_status_display()