From 40df2ea358d8ffaac60ae22060d94d55e51e88e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Nov 2012 22:33:17 +0100 Subject: [PATCH] Fix test on translation cache when value is None --- trytond/ir/translation.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 0b2dced6fb..6f36d687cb 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -204,8 +204,9 @@ class Translation(ModelSQL, ModelView): if not Transaction().context.get( 'fuzzy_translation', False): for obj_id in ids: - trans = cls._translation_cache.get((lang, ttype, name, obj_id)) - if trans is not None: + trans = cls._translation_cache.get((lang, ttype, name, obj_id), + -1) + if trans != -1: translations[obj_id] = trans else: to_fetch.append(obj_id) @@ -354,8 +355,8 @@ class Translation(ModelSQL, ModelView): lang = unicode(lang) if source is not None: source = unicode(source) - trans = cls._translation_cache.get((lang, ttype, name, source)) - if trans is not None: + trans = cls._translation_cache.get((lang, ttype, name, source), -1) + if trans != -1: return trans cursor = Transaction().cursor @@ -411,8 +412,8 @@ class Translation(ModelSQL, ModelView): lang = unicode(lang) if source is not None: source = unicode(source) - trans = cls._translation_cache.get((lang, ttype, name, source)) - if trans is not None: + trans = cls._translation_cache.get((lang, ttype, name, source), -1) + if trans != -1: res[(name, ttype, lang, source)] = trans else: res[(name, ttype, lang, source)] = None