Fix test on translation cache when value is None

This commit is contained in:
Cédric Krier committed 2012-11-22 22:33:17 +01:00
1 parent f452c68c50
commit 40df2ea358
1 file changed
+7 -6
+7 -6
View File
@@ -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