source: products/quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/Extensions/Install.py @ 1752

Last change on this file since 1752 was 1740, checked in by koval, 14 years ago

fixed buggy code in Install.py and removed unnecessary types.xml file

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1from Products.CMFCore.utils import getToolByName
2
3from quintagroup.seoptimizer.config import PROJECT_NAME
4
5# our GenericSetup profile names
6INSTALL = 'profile-%s:default' % PROJECT_NAME
7REINSTALL = 'profile-%s:reinstall' % PROJECT_NAME
8UNINSTALL = 'profile-%s:uninstall' % PROJECT_NAME
9
10def 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
24def 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."
Note: See TracBrowser for help on using the repository browser.