source: products/quintagroup.plonetabs/trunk/quintagroup/plonetabs/Extensions/Install.py @ 865

Last change on this file since 865 was 865, checked in by chervol, 17 years ago

fixed the typo

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1# -*- coding: utf-8 -*-
2
3import transaction
4from Products.CMFCore.utils import getToolByName
5
6PRODUCT_DEPENDENCIES = ()
7
8EXTENSION_PROFILES = (
9    'quintagroup.plonetabs:default',
10)
11
12UNINSTALL_PROFILES = (
13    'quintagroup.plonetabs:uninstall',
14)
15
16def install(self, reinstall=False):
17    """Install a set of products (which themselves may either use Install.py
18    or GenericSetup extension profiles for their configuration) and then
19    install a set of extension profiles.
20   
21    One of the extension profiles we install is that of this product. This
22    works because an Install.py installation script (such as this one) takes
23    precedence over extension profiles for the same product in
24    portal_quickinstaller.
25   
26    We do this because it is not possible to install other products during
27    the execution of an extension profile (i.e. we cannot do this during
28    the importVarious step for this profile).
29    """
30   
31    portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
32    portal_setup = getToolByName(self, 'portal_setup')
33
34    for product in PRODUCT_DEPENDENCIES:
35        if reinstall and portal_quickinstaller.isProductInstalled(product):
36            portal_quickinstaller.reinstallProducts([product])
37            transaction.savepoint()
38        if not portal_quickinstaller.isProductInstalled(product):
39            portal_quickinstaller.installProduct(product)
40            transaction.savepoint()
41   
42    for extension_id in EXTENSION_PROFILES:
43        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
44        product_name = extension_id.split(':')[0]
45        portal_quickinstaller.notifyInstalled(product_name)
46        transaction.savepoint()
47
48def uninstall(self):
49    portal_setup = getToolByName(self, 'portal_setup')
50    for extension_id in UNINSTALL_PROFILES:
51        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
52        product_name = extension_id.split(':')[0]
53        transaction.savepoint()
Note: See TracBrowser for help on using the repository browser.