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
RevLine 
[963]1import transaction
2from Products.CMFCore.utils import getToolByName
[2041]3REQUIRED = 'quintagroup.captcha.core'
[3270]4from quintagroup.plonecaptchas.config import HAS_APP_DISCUSSION
5from quintagroup.plonecaptchas.setuphandlers import registerDiscussionLayer
[963]6
[3160]7
[2041]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')
[3160]18    profile = 'profile-quintagroup.plonecaptchas:default'
19    gs.runAllImportStepsFromProfile(profile)
[3270]20    if HAS_APP_DISCUSSION:
21        # register browser layer
22        registerDiscussionLayer(self)
[2041]23    transaction.savepoint()
24
[3160]25
[963]26def uninstall(self):
27    portal_setup = getToolByName(self, 'portal_setup')
[3160]28    profile = 'profile-quintagroup.plonecaptchas:uninstall'
29    portal_setup.runAllImportStepsFromProfile(profile, purge_old=False)
[963]30    transaction.savepoint()
Note: See TracBrowser for help on using the repository browser.