1 | from Products.CMFCore.utils import getToolByName |
---|
2 | |
---|
3 | from quintagroup.seoptimizer.config import PROJECT_NAME |
---|
4 | |
---|
5 | # our GenericSetup profile names |
---|
6 | INSTALL = 'profile-%s:default' % PROJECT_NAME |
---|
7 | REINSTALL = 'profile-%s:reinstall' % PROJECT_NAME |
---|
8 | UNINSTALL = 'profile-%s:uninstall' % PROJECT_NAME |
---|
9 | |
---|
10 | def install(portal, reinstall=False): |
---|
11 | """ (Re)Install this product. |
---|
12 | |
---|
13 | This external method is need, because portal_quickinstaller doens't know |
---|
14 | what GenericProfile profile to apply when reinstalling a product. |
---|
15 | """ |
---|
16 | setup_tool = getToolByName(portal, 'portal_setup') |
---|
17 | if reinstall: |
---|
18 | setup_tool.runAllImportStepsFromProfile(REINSTALL) |
---|
19 | return "Ran all reinstall steps." |
---|
20 | else: |
---|
21 | setup_tool.runAllImportStepsFromProfile(INSTALL) |
---|
22 | return "Ran all install steps." |
---|
23 | |
---|
24 | def uninstall(portal, reinstall=False): |
---|
25 | """ Uninstall this product. |
---|
26 | |
---|
27 | This external method is need, because portal_quickinstaller doens't know |
---|
28 | what GenericProfile profile to apply when uninstalling a product. |
---|
29 | """ |
---|
30 | setup_tool = getToolByName(portal, 'portal_setup') |
---|
31 | if reinstall: |
---|
32 | return "Ran all reinstall steps." |
---|
33 | else: |
---|
34 | setup_tool.runAllImportStepsFromProfile(UNINSTALL) |
---|
35 | return "Ran all uninstall steps." |
---|