| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | # |
|---|
| 3 | # File: AppInstall.py |
|---|
| 4 | # |
|---|
| 5 | # Copyright (c) 2006 by CommunesPlone |
|---|
| 6 | # Generator: ArchGenXML Version 1.5.0 svn/devel |
|---|
| 7 | # http://plone.org/products/archgenxml |
|---|
| 8 | # |
|---|
| 9 | # GNU General Public License (GPL) |
|---|
| 10 | # |
|---|
| 11 | # This program is free software; you can redistribute it and/or |
|---|
| 12 | # modify it under the terms of the GNU General Public License |
|---|
| 13 | # as published by the Free Software Foundation; either version 2 |
|---|
| 14 | # of the License, or (at your option) any later version. |
|---|
| 15 | # |
|---|
| 16 | # This program is distributed in the hope that it will be useful, |
|---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | # GNU General Public License for more details. |
|---|
| 20 | # |
|---|
| 21 | # You should have received a copy of the GNU General Public License |
|---|
| 22 | # along with this program; if not, write to the Free Software |
|---|
| 23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 24 | # 02110-1301, USA. |
|---|
| 25 | # |
|---|
| 26 | |
|---|
| 27 | __author__ = """Gauthier BASTIEN <gbastien@commune.sambreville.be>""" |
|---|
| 28 | __docformat__ = 'plaintext' |
|---|
| 29 | |
|---|
| 30 | from Products.CMFCore.utils import getToolByName |
|---|
| 31 | from Products.ExternalMethod.ExternalMethod import manage_addExternalMethod |
|---|
| 32 | from zExceptions import BadRequest |
|---|
| 33 | |
|---|
| 34 | def install(self): |
|---|
| 35 | """ We add an ExternalMethod that can use urllib """ |
|---|
| 36 | try: |
|---|
| 37 | portal = getToolByName(self, 'portal_url', None).getPortalObject() |
|---|
| 38 | manage_addExternalMethod(portal, 'cpcurl', 'cpcurl', 'CPComarquage.cpcurl', 'cpcurl') |
|---|
| 39 | except: |
|---|
| 40 | #if the ExternalMethod already exists, we pass |
|---|
| 41 | pass |
|---|
| 42 | |
|---|
| 43 | #we add the Plone Property Sheet to portal_properties |
|---|
| 44 | self.portal_properties.addPropertySheet('cpcomarquage_properties', 'CPComarquage Properties', propertysheet=None) |
|---|
| 45 | |
|---|
| 46 | #we add the properties to the Property Sheet |
|---|
| 47 | self.portal_properties.cpcomarquage_properties.manage_addProperty('absolute_urls', True, 'boolean') |
|---|
| 48 | self.portal_properties.cpcomarquage_properties.manage_addProperty('full_replace', True, 'boolean') |
|---|
| 49 | |
|---|
| 50 | def uninstall(self): |
|---|
| 51 | """ Unistall method for CPComarquage """ |
|---|
| 52 | try: |
|---|
| 53 | #we remove the added property sheet |
|---|
| 54 | self.portal_properties.manage_delObjects(['cpcomarquage_properties']) |
|---|
| 55 | except BadRequest: |
|---|
| 56 | #if we do not find the cpcomarquage_properties Property Sheet, we pass |
|---|
| 57 | pass |
|---|