[FIX] styling fixes
authorXavier ALT <xal@openerp.com>
Fri, 14 Dec 2012 15:39:29 +0000 (16:39 +0100)
committerXavier ALT <xal@openerp.com>
Fri, 14 Dec 2012 15:39:29 +0000 (16:39 +0100)
bzr revid: xal@openerp.com-20121214153929-dcasngxib21nsvin

openerp/addons/base/ir/ir_translation.py

index 57ff687..905db22 100644 (file)
@@ -291,11 +291,14 @@ class ir_translation(osv.osv):
     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'))
@@ -303,10 +306,10 @@ class ir_translation(osv.osv):
             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)