diff --git a/product/ERP5Type/dynamic/accessor_holder.py b/product/ERP5Type/dynamic/accessor_holder.py index e3dd05bceccdc32f3a4212b709b23e83532c7407..c0d4301ea97437b4be2ce11e2765dcbea1689052 100644 --- a/product/ERP5Type/dynamic/accessor_holder.py +++ b/product/ERP5Type/dynamic/accessor_holder.py @@ -111,10 +111,8 @@ class AccessorHolderType(type): InitializeClass(accessor_holder_class) return accessor_holder_class - -generating_base_accessor_holder = False def _generateBaseAccessorHolder(portal, - accessor_holder_module): + accessor_holder_module): """ Create once an accessor holder that contains all accessors common to all portal types: erp5.accessor_holder.BaseAccessorHolder @@ -136,15 +134,9 @@ def _generateBaseAccessorHolder(portal, if accessor_holder is not None: return accessor_holder - global generating_base_accessor_holder - if generating_base_accessor_holder: - # can cause recursion, as accessing categories generates category properties - return None - generating_base_accessor_holder = True - + # When setting up the site, there will be no portal_categories portal_categories = getattr(portal, 'portal_categories', None) if portal_categories is None: - generating_base_accessor_holder = False return None base_category_list = portal_categories.objectIds() @@ -163,7 +155,6 @@ def _generateBaseAccessorHolder(portal, 'erp5.accessor_holder', initialize=False) setattr(accessor_holder_module, base_accessor_holder_id, accessor_holder) - generating_base_accessor_holder = False return accessor_holder def _generatePreferenceToolAccessorHolder(portal, accessor_holder_list, @@ -212,4 +203,3 @@ def _generatePreferenceToolAccessorHolder(portal, accessor_holder_list, initialize=False) setattr(accessor_holder_module, 'PreferenceTool', accessor_holder) return accessor_holder - diff --git a/product/ERP5Type/dynamic/portal_type_class.py b/product/ERP5Type/dynamic/portal_type_class.py index 40e3586d8aa66ef8d367b90d3cd9231ae221e7a3..93ed5c551b65803cd9f783ad6fef18b7e5223023 100644 --- a/product/ERP5Type/dynamic/portal_type_class.py +++ b/product/ERP5Type/dynamic/portal_type_class.py @@ -70,13 +70,10 @@ def _createAccessorHolderList(site, accessor_holder_list = [] if "Base" in property_sheet_name_set: - accessor_holder_class = None - # useless if Base Category is not yet here or if we're currently # generating accessors for Base Categories - if hasattr(erp5.accessor_holder, "BaseCategory"): - accessor_holder_class = _generateBaseAccessorHolder(site, - erp5.accessor_holder) + accessor_holder_class = _generateBaseAccessorHolder(site, + erp5.accessor_holder) if accessor_holder_class is not None: accessor_holder_list.append(accessor_holder_class)