[FIX] web: request dispatching wraps controller function call to retry request if psycopg raise OperationError and convert IntegrityError into except_orm with translated message.
bzr revid: chs@openerp.com-20131011113450-ktoaxul22p3nql75
This commit is contained in:
parent
273face907
commit
34d2fd4d02
|
@ -35,7 +35,7 @@ import urllib
|
|||
import urllib2
|
||||
|
||||
import openerp
|
||||
import openerp.service.security as security
|
||||
from openerp.service import security, model as service_model
|
||||
from openerp.tools import config
|
||||
|
||||
import inspect
|
||||
|
@ -1040,10 +1040,17 @@ class Root(object):
|
|||
func, arguments = urls.match(path)
|
||||
arguments = dict([(k, v) for k, v in arguments.items() if not k.startswith("_ignored_")])
|
||||
|
||||
@service_model.check
|
||||
def checked_call(dbname, *a, **kw):
|
||||
return func(*a, **kw)
|
||||
|
||||
def nfunc(*args, **kwargs):
|
||||
kwargs.update(arguments)
|
||||
if getattr(func, '_first_arg_is_req', False):
|
||||
args = (request,) + args
|
||||
|
||||
if request.db:
|
||||
return checked_call(request.db, *args, **kwargs)
|
||||
return func(*args, **kwargs)
|
||||
|
||||
request.func = nfunc
|
||||
|
|
Loading…
Reference in New Issue