From 8651971e89afdc10d660648ceeae166d23fe210e Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Fri, 24 Dec 2010 07:11:30 +0000
Subject: [PATCH] move block into lock: if several threads fiddle with
 erp5.accessor_holder at the same time, we could lose with some
 AttributeErrors

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41744 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/dynamic/portal_type_class.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/product/ERP5Type/dynamic/portal_type_class.py b/product/ERP5Type/dynamic/portal_type_class.py
index 448d2301d3..97113e4eb5 100644
--- a/product/ERP5Type/dynamic/portal_type_class.py
+++ b/product/ERP5Type/dynamic/portal_type_class.py
@@ -400,14 +400,14 @@ def synchronizeDynamicModules(context, force=False):
     for class_name, klass in inspect.getmembers(erp5.portal_type,
                                                 inspect.isclass):
       klass.restoreGhostState()
+
+    # Clear accessor holders of ZODB Property Sheets
+    for property_sheet_id in erp5.accessor_holder.__dict__.keys():
+      if not property_sheet_id.startswith('__'):
+        delattr(erp5.accessor_holder, property_sheet_id)
   finally:
     Base.aq_method_lock.release()
 
-  # Clear accessor holders of ZODB Property Sheets
-  for property_sheet_id in erp5.accessor_holder.__dict__.keys():
-    if not property_sheet_id.startswith('__'):
-      delattr(erp5.accessor_holder, property_sheet_id)
-
   # Necessary because accessors are wrapped in WorkflowMethod by
   # _aq_dynamic (performed in createAccessorHolder)
   _aq_reset()
-- 
2.30.9