From 52af3f37d0f459a2520941655fb9697282f378ba Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Tue, 2 Jul 2013 17:13:18 +0900 Subject: [PATCH] ZODB Components: Revert partially "ZODB Components: Fix bootstrap of migrated bt5s.". This reverts the following part of aed4f30: * Upon bt5 installation, install portal_type* items before bt5 {Document, Extensions...} as corresponding Portal Type are required once they have been migrated to ZODB Components. This obviously does not work as the Document can be used as Type Class and also because tool_item is required before portal_types for example (see test_type_provider). When bootstrapping erp5_core and installing for example an Extension Component, this will try to load Extension Component Portal Type which does not exist yet but fallback on its document class instead, which is enough until Extension Component Portal Type is installed. --- product/ERP5/Document/BusinessTemplate.py | 12 ++++++------ product/ERP5Type/Tool/ComponentTool.py | 23 +++++------------------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 18bcab6baf..8d223b209d 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -4810,12 +4810,6 @@ Business Template is a set of definitions, such as skins, portal types and categ _item_name_list = [ '_registered_version_priority_selection_item', '_workflow_item', - '_portal_type_item', - #'_portal_type_workflow_chain_item', - '_portal_type_allowed_content_type_item', - '_portal_type_hidden_content_type_item', - '_portal_type_property_sheet_item', - '_portal_type_base_category_item', '_product_item', '_document_item', '_property_sheet_item', @@ -4826,6 +4820,12 @@ Business Template is a set of definitions, such as skins, portal types and categ '_tool_item', '_message_translation_item', '_site_property_item', + '_portal_type_item', + #'_portal_type_workflow_chain_item', + '_portal_type_allowed_content_type_item', + '_portal_type_hidden_content_type_item', + '_portal_type_property_sheet_item', + '_portal_type_base_category_item', '_category_item', '_module_item', '_portal_type_roles_item', diff --git a/product/ERP5Type/Tool/ComponentTool.py b/product/ERP5Type/Tool/ComponentTool.py index e9ee4e027a..e7a8086798 100644 --- a/product/ERP5Type/Tool/ComponentTool.py +++ b/product/ERP5Type/Tool/ComponentTool.py @@ -143,30 +143,17 @@ class ComponentTool(BaseTool): LOG("ERP5Type.Tool.ComponentTool", INFO, "Resetting Components") - type_tool = portal.portal_types - - # One Component Package per allowed Portal Types on Component Tool - allowed_content_type_list = type_tool.getTypeInfo( - self.getPortalType()).getTypeAllowedContentTypeList() - - import erp5.component - # Make sure that it is not possible to load Components or load Portal Type # class when Components are reset through aq_method_lock + import erp5.component + from Products.ERP5Type.dynamic.component_package import ComponentDynamicPackage with Base.aq_method_lock: - for content_type in allowed_content_type_list: - package_name = content_type.split(' ')[0].lower() - - try: - package = getattr(erp5.component, package_name) - # XXX-arnau: not everything is defined yet... - except AttributeError: - pass - else: + for package in erp5.component.__dict__.itervalues(): + if isinstance(package, ComponentDynamicPackage): package.reset() if reset_portal_type_at_transaction_boundary: - type_tool.resetDynamicDocumentsOnceAtTransactionBoundary() + portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() else: from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules synchronizeDynamicModules(self, force) -- 2.30.9