source: products/quintagroup.ploneformgen.readonlystringfield/trunk/quintagroup/ploneformgen/readonlystringfield/Extensions/Install.py @ 826

Last change on this file since 826 was 825, checked in by myroslav, 17 years ago

PAS-enabled release

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