[IMP] simplify handling of callable _constraint message

This commit is contained in:
Xavier Morel 2014-05-27 11:39:32 +02:00
parent d8377a931e
commit d9ce012d29
1 changed files with 3 additions and 6 deletions

View File

@ -1562,12 +1562,9 @@ class BaseModel(object):
# Check presence of __call__ directly instead of using
# callable() because it will be deprecated as of Python 3.0
if hasattr(msg, '__call__'):
tmp_msg = msg(self, cr, uid, ids, context=context)
if isinstance(tmp_msg, tuple):
tmp_msg, params = tmp_msg
translated_msg = tmp_msg % params
else:
translated_msg = tmp_msg
translated_msg = msg(self, cr, uid, ids, context=context)
if isinstance(translated_msg, tuple):
translated_msg = translated_msg[0] % translated_msg[1]
else:
translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)
if extra_error: