From 0a04a94e2880b89d37419a213588ddaab5787001 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Wed, 29 Sep 2010 16:39:55 +0000
Subject: [PATCH] Fix test_167_InstanceAndRelatedClassDefinedInSameBT

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38768 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 7fc884c493..05b248cb49 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -3363,8 +3363,7 @@ class DocumentTemplateItem(BaseTemplateItem):
               raise
             continue
           if self.local_file_importer_name is not None:
-            self.local_file_importer_name(name)
-            # after any import, flush all ZODB caches to force a DB reload
+            # before any import, flush all ZODB caches to force a DB reload
             # otherwise we could have objects trying to get commited while
             # holding reference to a class that is no longer the same one as
             # the class in its import location and pickle doesn't tolerate it.
@@ -3375,6 +3374,7 @@ class DocumentTemplateItem(BaseTemplateItem):
             # connection
             self.getPortalObject()._p_jar.db().cacheMinimize()
             gc.collect()
+            self.local_file_importer_name(name)
     else:
       BaseTemplateItem.install(self, context, trashbin, **kw)
       for id in self._archive.keys():
-- 
2.30.9