LGTM.
Maybe the (small) duplication could be avoided by using an intermediate class:
class Translator(object): def __init__(cr, context): self.cr = cr self.context = context
def __call__(self, source): return translate(self.cr, None, 'view', self.context.get('lang'), source) or source
and then instantiate translate_view = Translator(cr, context), and call translate_view where needed.
« Back to merge proposal
LGTM.
Maybe the (small) duplication could be avoided by using an intermediate class:
class Translator(object):
def __init__(cr, context):
self.cr = cr
self.context = context
def __call__(self, source): get('lang' ), source) or source
return translate(self.cr, None, 'view', self.context.
and then instantiate translate_view = Translator(cr, context), and call translate_view where needed.