getattr(self, "_auth_method_%s" % auth_method)()
return auth_method
- def _handle_exception(self, e):
- fn = getattr(self, '_handle_%s' % getattr(e, 'code', 500), self._handle_500)
- return fn(e)
+ def _handle_exception(self, exception):
+ if isinstance(exception, openerp.exceptions.AccessError):
+ fn = self._handle_403
+ else:
+ code = getattr(exception, 'code', 500)
+ fn = getattr(self, '_handle_%s' % code)
+ return fn(exception)
def _handle_404(self, exception):
raise exception
def dispatch(self):
try:
r = self._call_function(**self.params)
- except werkzeug.exceptions.HTTPException, e:
+ except (openerp.exceptions.AccessError, werkzeug.exceptions.HTTPException), e:
r = e
except Exception, e:
_logger.exception("An exception occured during an http request")