Commit 168762f9 authored by Vincent Pelletier's avatar Vincent Pelletier

Add an extra check on meta_type before automaticaly creating an SQLCatalog.

Add code to remove SQLCatalog instance when all content has been uninstalled.
Do not get/set SQLCatalog properties on portal_catalog.getSQLCatalog() (which is the default catalog) but on the catalog corresponding to the ZSQLMethods being worked with. Thiw adds a limitation on business templates : all ZSQLMethods in a given business template must belong to the same SQLCatalog.
Remove an extra (useless) default catalog gathering.
Add dependency checking before business template preinstall and install.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11878 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a14cc591
...@@ -90,6 +90,32 @@ catalog_method_filter_list = ('_filter_expression_archive', ...@@ -90,6 +90,32 @@ catalog_method_filter_list = ('_filter_expression_archive',
'_filter_expression_instance_archive', '_filter_expression_instance_archive',
'_filter_type_archive',) '_filter_type_archive',)
def _getCatalog(acquisition_context):
"""
Return the id of the SQLCatalog which correspond to the current BT.
"""
catalog_method_id_list = acquisition_context.getTemplateCatalogMethodIdList()
if len(catalog_method_id_list) == 0:
return None
catalog_method_id = catalog_method_id_list[0]
return catalog_method_id.split('/')[0]
def _getCatalogValue(acquisition_context):
"""
Returns the catalog object which correspond to the ZSQLMethods
stored/to store in the business template.
NB: acquisition_context must make possible to reach portal object
and getTemplateCatalogMethodIdList.
"""
catalog_id = _getCatalog(acquisition_context)
if catalog_id is None:
return None
try:
return acquisition_context.getPortalObject().portal_catalog[catalog_id]
except KeyError:
return None
def removeAll(entry): def removeAll(entry):
''' '''
Remove all files and directories under 'entry'. Remove all files and directories under 'entry'.
...@@ -583,7 +609,10 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -583,7 +609,10 @@ class ObjectTemplateItem(BaseTemplateItem):
# If container's container is portal_catalog, # If container's container is portal_catalog,
# then automatically create the container. # then automatically create the container.
elif container_path[-2] == 'portal_catalog': elif container_path[-2] == 'portal_catalog':
# The id match, but better double check with the meta type
# while avoiding the impact of systematic check
container_container = portal.unrestrictedTraverse(container_path[:-1]) container_container = portal.unrestrictedTraverse(container_path[:-1])
if container_container.meta_type == 'ERP5 Catalog':
container_container.manage_addProduct['ZSQLCatalog'].manage_addSQLCatalog(id=container_path[-1], title='') container_container.manage_addProduct['ZSQLCatalog'].manage_addSQLCatalog(id=container_path[-1], title='')
if len(container_container.objectIds()) == 1: if len(container_container.objectIds()) == 1:
container_container.default_sql_catalog_id = container_path[-1] container_container.default_sql_catalog_id = container_path[-1]
...@@ -759,6 +788,9 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -759,6 +788,9 @@ class ObjectTemplateItem(BaseTemplateItem):
if trash and trashbin is not None: if trash and trashbin is not None:
self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, keep_subobjects=1) self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, keep_subobjects=1)
container.manage_delObjects([object_id]) container.manage_delObjects([object_id])
if container.aq_parent.meta_type == 'ERP5 Catalog' and len(container.objectIds()) == 0:
# We are removing a ZSQLMethod, remove the SQLCatalog if empty
container.aq_parent.manage_delObjects([container.id])
except (NotFound, KeyError, BadRequest): except (NotFound, KeyError, BadRequest):
# object is already backup and/or removed # object is already backup and/or removed
pass pass
...@@ -1628,10 +1660,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1628,10 +1660,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
ObjectTemplateItem.build(self, context, **kw) ObjectTemplateItem.build(self, context, **kw)
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
catalog = None
if catalog is None: if catalog is None:
LOG('BusinessTemplate build', 0, 'catalog not found') LOG('BusinessTemplate build', 0, 'catalog not found')
return return
...@@ -1657,10 +1686,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1657,10 +1686,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
catalog.filter_dict[method_id]['type'] catalog.filter_dict[method_id]['type']
def export(self, context, bta, **kw): def export(self, context, bta, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
catalog = None
if catalog is None: if catalog is None:
LOG('BusinessTemplate, export', 0, 'no SQL catalog was available') LOG('BusinessTemplate, export', 0, 'no SQL catalog was available')
return return
...@@ -1679,7 +1705,6 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1679,7 +1705,6 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f) XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f)
bta.addObject(obj=f.getvalue(), name=id, path=path) bta.addObject(obj=f.getvalue(), name=id, path=path)
# add all datas specific to catalog inside one file # add all datas specific to catalog inside one file
catalog = context.portal_catalog.getSQLCatalog()
method_id = obj.id method_id = obj.id
object_path = os.path.join(path, method_id+'.catalog_keys.xml') object_path = os.path.join(path, method_id+'.catalog_keys.xml')
...@@ -1724,10 +1749,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1724,10 +1749,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
ObjectTemplateItem.install(self, context, trashbin, **kw) ObjectTemplateItem.install(self, context, trashbin, **kw)
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -1828,10 +1850,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1828,10 +1850,7 @@ 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):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2671,10 +2690,7 @@ class RoleTemplateItem(BaseTemplateItem): ...@@ -2671,10 +2690,7 @@ class RoleTemplateItem(BaseTemplateItem):
class CatalogResultKeyTemplateItem(BaseTemplateItem): class CatalogResultKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2699,10 +2715,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem): ...@@ -2699,10 +2715,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2730,10 +2743,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem): ...@@ -2730,10 +2743,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem):
catalog.sql_search_result_keys = sql_search_result_keys catalog.sql_search_result_keys = sql_search_result_keys
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2771,10 +2781,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem): ...@@ -2771,10 +2781,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem):
class CatalogRelatedKeyTemplateItem(BaseTemplateItem): class CatalogRelatedKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2799,10 +2806,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem): ...@@ -2799,10 +2806,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2833,10 +2837,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem): ...@@ -2833,10 +2837,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_related_keys = tuple(sql_catalog_related_keys) catalog.sql_catalog_related_keys = tuple(sql_catalog_related_keys)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2874,10 +2875,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem): ...@@ -2874,10 +2875,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem):
class CatalogResultTableTemplateItem(BaseTemplateItem): class CatalogResultTableTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2902,10 +2900,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem): ...@@ -2902,10 +2900,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2933,10 +2928,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem): ...@@ -2933,10 +2928,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem):
catalog.sql_search_tables = tuple(sql_search_tables) catalog.sql_search_tables = tuple(sql_search_tables)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -2975,10 +2967,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem): ...@@ -2975,10 +2967,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem):
class CatalogKeywordKeyTemplateItem(BaseTemplateItem): class CatalogKeywordKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3003,10 +2992,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem): ...@@ -3003,10 +2992,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3034,10 +3020,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem): ...@@ -3034,10 +3020,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_keyword_search_keys = sql_keyword_keys catalog.sql_catalog_keyword_search_keys = sql_keyword_keys
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3076,10 +3059,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem): ...@@ -3076,10 +3059,7 @@ class CatalogKeywordKeyTemplateItem(BaseTemplateItem):
class CatalogFullTextKeyTemplateItem(BaseTemplateItem): class CatalogFullTextKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3104,10 +3084,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem): ...@@ -3104,10 +3084,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3135,10 +3112,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem): ...@@ -3135,10 +3112,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_full_text_search_keys = sql_full_text_keys catalog.sql_catalog_full_text_search_keys = sql_full_text_keys
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3178,10 +3152,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem): ...@@ -3178,10 +3152,7 @@ class CatalogFullTextKeyTemplateItem(BaseTemplateItem):
class CatalogRequestKeyTemplateItem(BaseTemplateItem): class CatalogRequestKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3206,10 +3177,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem): ...@@ -3206,10 +3177,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3237,10 +3205,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem): ...@@ -3237,10 +3205,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys) catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3279,10 +3244,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem): ...@@ -3279,10 +3244,7 @@ class CatalogRequestKeyTemplateItem(BaseTemplateItem):
class CatalogMultivalueKeyTemplateItem(BaseTemplateItem): class CatalogMultivalueKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3307,10 +3269,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem): ...@@ -3307,10 +3269,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3337,10 +3296,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem): ...@@ -3337,10 +3296,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys) catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3379,10 +3335,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem): ...@@ -3379,10 +3335,7 @@ class CatalogMultivalueKeyTemplateItem(BaseTemplateItem):
class CatalogTopicKeyTemplateItem(BaseTemplateItem): class CatalogTopicKeyTemplateItem(BaseTemplateItem):
def build(self, context, **kw): def build(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3407,10 +3360,7 @@ class CatalogTopicKeyTemplateItem(BaseTemplateItem): ...@@ -3407,10 +3360,7 @@ class CatalogTopicKeyTemplateItem(BaseTemplateItem):
self._objects[file_name[:-4]] = list self._objects[file_name[:-4]] = list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3438,10 +3388,7 @@ class CatalogTopicKeyTemplateItem(BaseTemplateItem): ...@@ -3438,10 +3388,7 @@ class CatalogTopicKeyTemplateItem(BaseTemplateItem):
catalog.sql_catalog_topic_search_keys = sql_catalog_topic_search_keys catalog.sql_catalog_topic_search_keys = sql_catalog_topic_search_keys
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
try: catalog = _getCatalogValue(self)
catalog = context.portal_catalog.getSQLCatalog()
except KeyError:
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
...@@ -3984,6 +3931,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3984,6 +3931,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
and the one installed if exists and the one installed if exists
""" """
self.checkDependencies()
modified_object_list = {} modified_object_list = {}
bt_title = self.getTitle() bt_title = self.getTitle()
...@@ -4069,6 +4018,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4069,6 +4018,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
if self.getTemplateFormatVersion() == 0: if self.getTemplateFormatVersion() == 0:
force = 1 force = 1
if not force:
self.checkDependencies()
site = self.getPortalObject() site = self.getPortalObject()
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5.ERP5Site import ERP5Generator
gen = ERP5Generator() gen = ERP5Generator()
...@@ -4121,7 +4073,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4121,7 +4073,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
update_catalog = 1 update_catalog = 1
break break
if update_catalog: if update_catalog:
catalog = local_configuration.portal_catalog.getSQLCatalog() catalog = _getCatalogValue(self)
if (catalog is None) or (not site.isIndexable): if (catalog is None) or (not site.isIndexable):
LOG('Business Template', 0, 'no SQL Catalog available') LOG('Business Template', 0, 'no SQL Catalog available')
update_catalog = 0 update_catalog = 0
......
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