erp5_catalog: Dynamic migration
And, Patch changeObjectClass extension to remove useless attributes Copying __dict__ from one object to another brings us to situation where we don have many objects which we don't need at all, for example, migrating objects with subclasses who were initially OFS objects and later an ERP5 object can lead to adding subobjects as attributes of the new object, which is completely undesirable. To handle this, it is important to delete the sub-objects as the attributes for those migrated classes. erp5_catalog: Refactor _bootstrap for Catalog Tool Old Catalog Tool didn't have portal_type attribute, so while migrating via synchronizeDynamicModule, after _bootstrap, we expect the tool to have a portal_type to finalize migration. This step is now being done only at the end of _bootstrap after we change the classes for portal_catalog and its sub-objects. And, changes to improve performance while dynamic migration. XXX: Still at this point we are not doing the same thing with sub-objects of catalog tool and wait till business template installation. erp5_catalog: Update attributes of the portal_catalog object after migration
Showing
... | ... | @@ -327,13 +327,23 @@ def synchronizeDynamicModules(context, force=False): |
from Products.ERP5Type.Tool.PropertySheetTool import PropertySheetTool | ||
from Products.ERP5Type.Tool.TypesTool import TypesTool | ||
from Products.ERP5Type.Tool.ComponentTool import ComponentTool | ||
from Products.ERP5Catalog.Tool.ERP5CatalogTool import ERP5CatalogTool | ||
try: | ||
for tool_class in TypesTool, PropertySheetTool, ComponentTool: | ||
for tool_class in TypesTool, PropertySheetTool, ComponentTool, ERP5CatalogTool: | ||
# if the instance has no property sheet tool, or incomplete | ||
# property sheets, we need to import some data to bootstrap | ||
# (only likely to happen on the first run ever) | ||
tool_id = tool_class.id | ||
tool = getattr(portal, tool_id, None) | ||
if tool_class == ERP5CatalogTool and tool is None: | ||
|
||
# Wait till we find that SQL Catalog Tool is installed | ||
# Simpy said, we don't want ERP5 Catalog Tool to be installed | ||
# from here. So, we come to 2 cases: | ||
# 1. Running ERP5Site with sql catalog_tool : In that case, we end up | ||
# running _bootstrap from here, leading to migration. | ||
# 2. New ERP5Site : In this case, we don't do anything here, cause | ||
# the catalog_tool would be ERP5CatalogTool, so this would just pass. | ||
continue | ||
if tool is None: | ||
tool = tool_class() | ||
portal._setObject(tool_id, tool, set_owner=False, | ||
... | ... |
-
erp5_catalog: Refactor _bootstrap for Catalog Tool
What does this mean ?