Last change
on this file since 10457 was
10084,
checked in by Henrik Bettermann, 12 years ago
|
Fill trunk.
|
-
Property svn:keywords set to
Id
|
File size:
1.3 KB
|
Rev | Line | |
---|
[10084] | 1 | # -*- coding: utf-8 -*- |
---|
| 2 | |
---|
| 3 | from Products.CMFPlone.utils import getToolByName |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | def isPlone42(portal): |
---|
| 7 | migration_tool = getToolByName(portal, 'portal_migration') |
---|
| 8 | core_versions = migration_tool.coreVersions() |
---|
| 9 | plone = core_versions.get('Plone', '') |
---|
| 10 | if plone: |
---|
| 11 | versions = plone.split('.') |
---|
| 12 | return versions[0] == '4' and versions[1] == '2' |
---|
| 13 | |
---|
| 14 | return False |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | def isPlone41(portal): |
---|
| 18 | migration_tool = getToolByName(portal, 'portal_migration') |
---|
| 19 | core_versions = migration_tool.coreVersions() |
---|
| 20 | plone = core_versions.get('Plone', '') |
---|
| 21 | if plone: |
---|
| 22 | versions = plone.split('.') |
---|
| 23 | return versions[0] == '4' and versions[1] == '1' |
---|
| 24 | |
---|
| 25 | return False |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | def uninstall(portal): |
---|
| 29 | """ Apply the correct so called uninstall-profile when uninstalling |
---|
| 30 | according to the installed Plone version |
---|
| 31 | """ |
---|
| 32 | |
---|
| 33 | if isPlone42(portal): |
---|
| 34 | profile = 'profile-waeup.plonetheme.ngren3:uninstall' |
---|
| 35 | elif isPlone41(portal): |
---|
| 36 | profile = 'profile-waeup.plonetheme.ngren3:uninstall-plone41' |
---|
| 37 | else: |
---|
| 38 | profile = '' |
---|
| 39 | |
---|
| 40 | if profile: |
---|
| 41 | setup_tool = getToolByName(portal, 'portal_setup') |
---|
| 42 | setup_tool.runAllImportStepsFromProfile(profile) |
---|
| 43 | return "Ran all uninstall steps." |
---|
| 44 | |
---|
| 45 | else: |
---|
| 46 | return "Nothing to uninstall" |
---|
Note: See
TracBrowser for help on using the repository browser.