1 """This module handles the product install process.
2 """
3
4 import logging
5 logger = logging.getLogger('icsemantic.catalog: setuphandlers')
6
7 import transaction
8
9 from Products.CMFCore.utils import getToolByName
10
11 from platecom.ontocatalog.config import PROJECTNAME, DEPENDENCIES
12 from platecom.ontocatalog.config import RELATED_IDX
13 from platecom.ontocatalog.config import SYNONYM_IDX
14 from platecom.ontocatalog.config import TRANSLATION_IDX
15
16
18 """Ordinarily, GenericSetup handlers check for the existence of
19 XML files. Here, we are not parsing an XML file, but we use this
20 text file as a flag to check that we actually meant for this import
21 step to be run. The file is found in profiles/default.
22 """
23 return context.readDataFile("icsemantic.catalog_marker.txt") is not None
24
25
39
40
42 """Update ATCT tool with criteria for synonyms, translations and
43 relations.
44 """
45 atct_tool = getToolByName(context.getSite(), 'portal_atct')
46 atct_tool.addIndex(SYNONYM_IDX, friendlyName='Synonyms', enabled=1)
47 atct_tool.addIndex(TRANSLATION_IDX, friendlyName='Translations', enabled=1)
48 atct_tool.addIndex(RELATED_IDX, friendlyName='Relations', enabled=1)
49
50
52 """Install dependencies"""
53 quickinstaller = getToolByName(context.getSite(), 'portal_quickinstaller')
54 for product in DEPENDENCIES:
55 if quickinstaller.isProductInstalled(product):
56 quickinstaller.reinstallProducts([product])
57 transaction.savepoint()
58 else:
59 quickinstaller.installProduct(product)
60 transaction.savepoint()
61
62
71