Commit 8d6d3e46 authored by Aurel's avatar Aurel

uninstall of catalog method depends of the Business Template format


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4828 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent befaeb1a
...@@ -1297,25 +1297,24 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1297,25 +1297,24 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
catalog.sql_clear_catalog = tuple(sql_clear_catalog) catalog.sql_clear_catalog = tuple(sql_clear_catalog)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
ObjectTemplateItem.uninstall(self, context, **kw)
try: try:
catalog = context.portal_catalog.getSQLCatalog() catalog = context.portal_catalog.getSQLCatalog()
except KeyError: except KeyError:
catalog = None catalog = None
if catalog is None: if catalog is None:
LOG('BusinessTemplate', 0, 'no SQL catalog was available') LOG('BusinessTemplate', 0, 'no SQL catalog was available')
return return
values = [] values = []
object_path = kw.get('object_path', None) object_path = kw.get('object_path', None)
# get required values # get required values
if object_path is None: if object_path is None:
values = self._archive.values() if context.getTemplateFormatVersion() == 1:
values = self._objects.values()
else:
values = self._archive.values()
else: else:
values.append(self._archive[object_path]) values.append(self._archive[object_path])
# Make copies of attributes of the default catalog of portal_catalog. # Make copies of attributes of the default catalog of portal_catalog.
# sql_catalog_object = list(catalog.sql_catalog_object) # sql_catalog_object = list(catalog.sql_catalog_object)
sql_catalog_object_list = list(catalog.sql_catalog_object_list) sql_catalog_object_list = list(catalog.sql_catalog_object_list)
...@@ -1325,31 +1324,25 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1325,31 +1324,25 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
for obj in values: for obj in values:
method_id = obj.id method_id = obj.id
# if method_id in sql_catalog_object: # if method_id in sql_catalog_object:
# sql_catalog_object.remove(method_id) # sql_catalog_object.remove(method_id)
if method_id in sql_catalog_object_list: if method_id in sql_catalog_object_list:
sql_catalog_object_list.remove(method_id) sql_catalog_object_list.remove(method_id)
if method_id in sql_uncatalog_object: if method_id in sql_uncatalog_object:
sql_uncatalog_object.remove(method_id) sql_uncatalog_object.remove(method_id)
# if method_id in sql_update_object: # if method_id in sql_update_object:
# sql_update_object.remove(method_id) # sql_update_object.remove(method_id)
if method_id in sql_clear_catalog: if method_id in sql_clear_catalog:
sql_clear_catalog.remove(method_id) sql_clear_catalog.remove(method_id)
if catalog.filter_dict.has_key(method_id): if catalog.filter_dict.has_key(method_id):
del catalog.filter_dict[method_id] del catalog.filter_dict[method_id]
# catalog.sql_catalog_object = tuple(sql_catalog_object) # catalog.sql_catalog_object = tuple(sql_catalog_object)
catalog.sql_catalog_object_list = tuple(sql_catalog_object_list) catalog.sql_catalog_object_list = tuple(sql_catalog_object_list)
catalog.sql_uncatalog_object = tuple(sql_uncatalog_object) catalog.sql_uncatalog_object = tuple(sql_uncatalog_object)
# catalog.sql_update_object = tuple(sql_update_object) # catalog.sql_update_object = tuple(sql_update_object)
catalog.sql_clear_catalog = tuple(sql_clear_catalog) catalog.sql_clear_catalog = tuple(sql_clear_catalog)
# uninstall objects
ObjectTemplateItem.uninstall(self, context, **kw) ObjectTemplateItem.uninstall(self, context, **kw)
def _importFile(self, file_name, file): def _importFile(self, file_name, file):
......
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