Commits

Michał Jaworski committed 1f43304

exception throwing less ambiguous

Comments (0)

Files changed (1)

oauth_provider/decorators.py

-from oauth2 import Error
+import oauth2
 
 try:
     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')))
             try:
                 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.')))
 
     @staticmethod
     def is_valid_request(request):