[IMP] better api for ir.http#_authenticate

bzr revid: fme@openerp.com-20131126121024-v5f9i7ssgaqm7dmk
This commit is contained in:
Fabien Meghazi
2013-11-26 13:10:24 +01:00
parent 1235955197
commit f15b0120e8
+2 -3
View File
@@ -76,8 +76,7 @@ class ir_http(osv.AbstractModel):
request.disable_db = True
request.uid = None
def _authenticate(self, func, arguments):
auth_method = getattr(func, "auth", "user")
def _authenticate(self, auth_method='user'):
if request.session.uid:
try:
request.session.check_security()
@@ -111,7 +110,7 @@ class ir_http(osv.AbstractModel):
# check authentication level
try:
auth_method = self._authenticate(func, arguments)
auth_method = self._authenticate(getattr(func, "auth", None))
except Exception:
# force a Forbidden exception with the original traceback
return self._handle_exception(