Commit c426efb9 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Naming changes in migrateSQLCatalogToERP5Catalog as per context of the function

parent 658dd8de
...@@ -1704,7 +1704,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1704,7 +1704,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
# Getting ERP5 Catalog Tool # Getting ERP5 Catalog Tool
catalog_tool = self.portal_catalog catalog_tool = self.portal_catalog
sql_catalog = catalog_tool.getSQLCatalog() sql_catalog = catalog_tool.getSQLCatalog()
new_id = 'erp5_mysql_innodb_new' erp5_catalog_id = 'erp5_mysql_innodb_new'
# If there is no default SQL Catalog installed already, add a warning log # If there is no default SQL Catalog installed already, add a warning log
# in ERP5Site and break the migration # in ERP5Site and break the migration
if not sql_catalog: if not sql_catalog:
...@@ -1714,15 +1714,15 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1714,15 +1714,15 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
return return
if not isinstance(sql_catalog, ERP5Catalog): if not isinstance(sql_catalog, ERP5Catalog):
if new_id not in catalog_tool.objectIds(): if erp5_catalog_id not in catalog_tool.objectIds():
# Create new ERP5Catalog object if it doesn't exist # Create new ERP5Catalog object if it doesn't exist
catalog_tool.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog( catalog_tool.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog(
id = new_id, id = erp5_catalog_id,
title = '') title = '')
new_erp5_catalog = catalog_tool._getOb(new_id) erp5_catalog = catalog_tool._getOb(erp5_catalog_id)
# No need to migrate if the new_erp5_catalog is not an object of ERP5Catlog # No need to migrate if the erp5_catalog is not an object of ERP5Catlog
if not isinstance(new_erp5_catalog, ERP5Catalog): if not isinstance(erp5_catalog, ERP5Catalog):
return return
# Copy-paste objects from SQLCatalog to ERP5Catalog # Copy-paste objects from SQLCatalog to ERP5Catalog
...@@ -1730,14 +1730,14 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1730,14 +1730,14 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
ob = sql_catalog._getOb(id) ob = sql_catalog._getOb(id)
# Check if the object is copyable and that it doesn't already exist # Check if the object is copyable and that it doesn't already exist
# The copying attributes are from OFS.CopySupport # The copying attributes are from OFS.CopySupport
if hasattr(ob, '_canCopy') and not new_erp5_catalog.has_key(id): if hasattr(ob, '_canCopy') and not erp5_catalog.has_key(id):
# Get a copy of object for new conainer, i.e. new_erp5_catalog # Get a copy of object for new conainer, i.e. erp5_catalog
ob = ob._getCopy(new_erp5_catalog) ob = ob._getCopy(erp5_catalog)
ob._setId(id) ob._setId(id)
# Set the copied object in the new_erp5_catalog # Set the copied object in the erp5_catalog
new_erp5_catalog._setObject(id, ob) erp5_catalog._setObject(id, ob)
ob = new_erp5_catalog._getOb(id) ob = erp5_catalog._getOb(id)
ob._postCopy(new_erp5_catalog, op=0) ob._postCopy(erp5_catalog, op=0)
# Update properties list for the new catalog from the SQLCatalog # Update properties list for the new catalog from the SQLCatalog
# Not an efficient way to carry this # Not an efficient way to carry this
...@@ -1747,11 +1747,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1747,11 +1747,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
# https://lab.nexedi.com/nexedi/erp5/blob/198df7021a17725e81ab930015c3c618e94263db/product/ERP5Type/Base.py#L3531 # https://lab.nexedi.com/nexedi/erp5/blob/198df7021a17725e81ab930015c3c618e94263db/product/ERP5Type/Base.py#L3531
if not property_id == 'title': if not property_id == 'title':
value = getattr(sql_catalog, property_id) value = getattr(sql_catalog, property_id)
new_erp5_catalog._updateProperty(id=property_id, value=value) erp5_catalog._updateProperty(id=property_id, value=value)
# Update default erp5 catalog id, everytime we run migration # Update default erp5 catalog id, everytime we run migration
# ERP5 Catalog(basically when this fucntion is called while creating ERP5Site) # ERP5 Catalog(basically when this fucntion is called while creating ERP5Site)
catalog_tool.default_erp5_catalog_id = new_id catalog_tool.default_erp5_catalog_id = erp5_catalog_id
Globals.InitializeClass(ERP5Site) Globals.InitializeClass(ERP5Site)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment