[FIX] http.py use checked_call for concurrency retry and exception handling
authorAntony Lesuisse <al@openerp.com>
Sun, 10 Nov 2013 14:07:57 +0000 (15:07 +0100)
committerAntony Lesuisse <al@openerp.com>
Sun, 10 Nov 2013 14:07:57 +0000 (15:07 +0100)
bzr revid: al@openerp.com-20131110140757-tbe8yondadokd4ke

openerp/addons/base/ir/ir_http.py
openerp/http.py

index 6f77f9f..9fd485d 100644 (file)
@@ -55,9 +55,6 @@ class ir_http(osv.AbstractModel):
     
     _description = "HTTP routing"
 
-    def __init__(self, registry, cr):
-        osv.osv.__init__(self, registry, cr)
-
     def _find_handler(self):
         # TODO move to __init__(self, registry, cr)
         if not hasattr(self, 'routing_map'):
index 0a0f135..a7964be 100644 (file)
@@ -169,10 +169,12 @@ class WebRequest(object):
                 # Backward for 7.0
                 if getattr(self.func, '_first_arg_is_req', False):
                     args = (request,) + args
-                # TODO by chs
-                #@service_model.check
-                #def checked_call(dbname, *a, **kw):
-                #    return func(*a, **kw)
+                # Correct exception handling and concurency retry
+                @service_model.check
+                def checked_call(dbname, *a, **kw):
+                    return self.func(*a, **kw)
+                if self.db:
+                    return checked_call(self.db, *args, **kwargs)
                 return self.func(*args, **kwargs)
         finally:
             # just to be sure no one tries to re-use the request