def _clear_cache_for(self, cr, uid, name, type, lang, src, res_id):
""" clear translation cache for the requested value
"""
+ # handle special cases for:
+ # - 'report_sxw' and '_()' translations which are requested using
+ # multiple types (and so generating a different cache key than if
+ # requested with each types individually).
+ # - 'code', 'sql_constraint' which are requested with name = None
+ # - 'field' and 'help' type which are requested without 'src' param
+ use_src = True
types_to_invalidate = [ type ]
- # handle special cases for 'report_sxw' and '_()' translations which
- # are requested using multiple types (and so generating a different
- # cache key than if requested with each types individually). So we have
- # to ensure both keys are cleared for proper cache consistency.
if type in ('report', 'rml'):
types_to_invalidate.append((type == 'rml' and 'report' or 'rml'))
types_to_invalidate.append(('report', 'rml'))
name = None # GettextAlias always request source with name = None
types_to_invalidated.append(('code','sql_constraint'))
elif type in ('field', 'help'):
- src = None # orm fields_get() request translation without source
+ use_src = None # orm fields_get() request translation without source
for type in types_to_invalidate:
- if not src:
+ if not use_src:
self._get_source.clear_cache(self, uid, name, type, lang)
else:
self._get_source.clear_cache(self, uid, name, type, lang, src)