[IMP] better syntax for routing_map cache invalidation
authorFabien Meghazi <fme@openerp.com>
Thu, 20 Mar 2014 15:36:51 +0000 (16:36 +0100)
committerFabien Meghazi <fme@openerp.com>
Thu, 20 Mar 2014 15:36:51 +0000 (16:36 +0100)
bzr revid: fme@openerp.com-20140320153651-4lkoekzhawny0p85

openerp/addons/base/ir/ir_http.py
openerp/modules/loading.py

index 62ecd60..ede0d7a 100644 (file)
@@ -145,6 +145,11 @@ class ir_http(osv.AbstractModel):
 
         return self._routing_map
 
+    def refresh_routing_map(self):
+        if hasattr(ir_http, '_routing_map'):
+            del(ir_http._routing_map)
+        return self.routing_map()
+
 def convert_exception_to(to_type, with_message=False):
     """ Should only be called from an exception handler. Fetches the current
     exception data from sys.exc_info() and creates a new exception of type
index 681d853..979917d 100644 (file)
@@ -186,11 +186,9 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
                 if tools.config.options['test_enable']:
                     # Yamel test
                     report.record_result(load_test(module_name, idref, mode))
+                    # Force routing map to be rebuilt between each test suite on modules
+                    registry['ir.http'].refresh_routing_map()
                     # Python tests
-                    ir_http = registry['ir.http']
-                    if hasattr(ir_http, '_routing_map'):
-                        # Force routing map to be rebuilt between each module test suite
-                        del(ir_http._routing_map)
                     report.record_result(openerp.modules.module.run_unit_tests(module_name, cr.dbname))
 
             processed_modules.append(package.name)