source: products/quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/Extensions/Install.py @ 3270

Last change on this file since 3270 was 3270, checked in by vmaksymiv, 13 years ago

compatibility with plone.app.discussion added

File size: 1.1 KB
Line 
1import transaction
2from Products.CMFCore.utils import getToolByName
3REQUIRED = 'quintagroup.captcha.core'
4from quintagroup.plonecaptchas.config import HAS_APP_DISCUSSION
5from quintagroup.plonecaptchas.setuphandlers import registerDiscussionLayer
6
7
8def install(self):
9    qi = getToolByName(self, 'portal_quickinstaller')
10    # install required quintagroup.captcha.core product
11    # BBB: Need to success installation in Plone<3.1
12    #      (with GenericSetup < v1.4.2, where dependency
13    #       support was not yet implemented)
14    if not REQUIRED in qi.listInstalledProducts():
15        qi.installProduct(REQUIRED)
16    # install plonecaptchas
17    gs = getToolByName(self, 'portal_setup')
18    profile = 'profile-quintagroup.plonecaptchas:default'
19    gs.runAllImportStepsFromProfile(profile)
20    if HAS_APP_DISCUSSION:
21        # register browser layer
22        registerDiscussionLayer(self)
23    transaction.savepoint()
24
25
26def uninstall(self):
27    portal_setup = getToolByName(self, 'portal_setup')
28    profile = 'profile-quintagroup.plonecaptchas:uninstall'
29    portal_setup.runAllImportStepsFromProfile(profile, purge_old=False)
30    transaction.savepoint()
Note: See TracBrowser for help on using the repository browser.