| 1 |
# -*- coding: utf-8 -*- |
|---|
| 2 |
# |
|---|
| 3 |
# File: CustomizationPolicy.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 |
|
|---|
| 31 |
# |
|---|
| 32 |
# NOTE: archgenxml doesn't regenerate this file! You can tamper with |
|---|
| 33 |
# it to your heart's content. |
|---|
| 34 |
# |
|---|
| 35 |
from zLOG import LOG, INFO |
|---|
| 36 |
from Products.CMFPlone.Portal import addPolicy |
|---|
| 37 |
from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy |
|---|
| 38 |
from Products.CMFCore.utils import getToolByName |
|---|
| 39 |
|
|---|
| 40 |
from config import PROJECTNAME |
|---|
| 41 |
|
|---|
| 42 |
class CPComarquageCustomizationPolicy(DefaultCustomizationPolicy): |
|---|
| 43 |
"""Make a custom Plone for TeleServices.""" |
|---|
| 44 |
|
|---|
| 45 |
def customize(self, portal): |
|---|
| 46 |
"""Custom customize method.""" |
|---|
| 47 |
# If the customization Policy is called inside an already |
|---|
| 48 |
# existing portal, calling the |
|---|
| 49 |
# DefaultCustomizationPolicy.customize is a problem. This ugly |
|---|
| 50 |
# try/except works, but should somewhere in future be replaced |
|---|
| 51 |
# by a test from which location we are calling. |
|---|
| 52 |
try: |
|---|
| 53 |
DefaultCustomizationPolicy.customize(self, portal) |
|---|
| 54 |
"""On va chercher les différentes méthodes dans ConfigurationMethods.py """ |
|---|
| 55 |
mi_tool = getToolByName(portal, 'portal_migration') |
|---|
| 56 |
gs = mi_tool._getWidget('CPComarquage Setup') |
|---|
| 57 |
gs.addItems(gs.available()) |
|---|
| 58 |
except: |
|---|
| 59 |
print "Error during customize of CPComarquageCustomizationPolicy" |
|---|
| 60 |
pass |
|---|
| 61 |
|
|---|
| 62 |
# Call all methods starting with 'customize' |
|---|
| 63 |
LOG(PROJECTNAME, INFO, "Customization Policy applied:") |
|---|
| 64 |
for method in dir(self): |
|---|
| 65 |
if method.startswith('customize') and method!='customize': |
|---|
| 66 |
print "Processing customization '%s' ..." % method |
|---|
| 67 |
eval('self.%s(portal)' % method) |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
#def customize_1_InstallProducts(self, portal): |
|---|
| 71 |
"""Install the product. |
|---|
| 72 |
|
|---|
| 73 |
Note that you can add dependencies to the DEPENDENCIES list in |
|---|
| 74 |
config.py, these are auto-installed by Install.py so no need |
|---|
| 75 |
to add them here. |
|---|
| 76 |
""" |
|---|
| 77 |
#portal.portal_quickinstaller.installProduct(PROJECTNAME) |
|---|
| 78 |
#get_transaction().commit(1) |
|---|
| 79 |
|
|---|
| 80 |
# Define your own customize_#_name methods after this |
|---|
| 81 |
# line. |
|---|
| 82 |
|
|---|
| 83 |
def register(context): |
|---|
| 84 |
addPolicy('CPComarquage', CPComarquageCustomizationPolicy()) |
|---|