1. David Larlet
  2. django-oauth-plus


Michał Jaworski  committed 1f43304

exception throwing less ambiguous

  • Participants
  • Parent commits 13c01a6
  • Branches default

Comments (0)

Files changed (1)

File oauth_provider/decorators.py

View file
-from oauth2 import Error
+import oauth2
     from functools import update_wrapper
                 token = store.get_access_token(request, oauth_request, 
                                 consumer, oauth_request.get_parameter('oauth_token'))
             except InvalidTokenError:
-                return send_oauth_error(Error(_('Invalid access token: %s') % oauth_request.get_parameter('oauth_token')))
+                return send_oauth_error(oauth2.Error(_('Invalid access token: %s') % oauth_request.get_parameter('oauth_token')))
                 self.validate_token(request, consumer, token)
-            except Error, e:
+            except oauth2.Error, e:
                 return send_oauth_error(e)
             if self.resource_name and token.resource.name != self.resource_name:
-                return send_oauth_error(Error(_('You are not allowed to access this resource.')))
+                return send_oauth_error(oauth2.Error(_('You are not allowed to access this resource.')))
             elif consumer and token:
                 return self.view_func(request, *args, **kwargs)
-        return send_oauth_error(Error(_('Invalid request parameters.')))
+        return send_oauth_error(oauth2.Error(_('Invalid request parameters.')))
     def is_valid_request(request):