[IMP] better api for ir.http#_authenticate
authorFabien Meghazi <fme@openerp.com>
Tue, 26 Nov 2013 12:10:24 +0000 (13:10 +0100)
committerFabien Meghazi <fme@openerp.com>
Tue, 26 Nov 2013 12:10:24 +0000 (13:10 +0100)
bzr revid: fme@openerp.com-20131126121024-v5f9i7ssgaqm7dmk

openerp/addons/base/ir/ir_http.py

index 0cd456c..b60df2f 100644 (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(