source: products/quintagroup.plonecaptchas/branches/plone4/quintagroup/plonecaptchas/Extensions/Install.py @ 3160

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

pep8fixes

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