root/communesplone/CPComarquage/tags/1.0/__init__.py

Revision 1319, 3.2 kB (checked in by gbastien, 2 years ago)

New imports to fit new Plone and CMF versions

  • Property svn:eol-style set to native
  • Property svn:executable set to
Line 
1 # -*- coding: utf-8 -*-
2 #
3 # File: __init__.py
4 #
5 # Copyright (c) 2006 by CommunesPlone
6 #
7 # GNU General Public License (GPL)
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License
11 # as published by the Free Software Foundation; either version 2
12 # of the License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # 02110-1301, USA.
23 #
24
25 __author__ = """Gauthier BASTIEN <gbastien@commune.sambreville.be>"""
26 __docformat__ = 'plaintext'
27
28 #
29 # Initialise the product's module. There are three ways to inject custom code
30 # here:
31 #
32 #   - To set global configuration variables, create a file AppConfig.py. This
33 #       will be imported in config.py, which in turn is imported in each
34 #       generated class and in this file.
35 #   - To perform custom initialisation after types have been registered, use
36 #       the protected code section at the bottom of initialize().
37 #   - To register a customisation policy, create a file CustomizationPolicy.py
38 #       with a method register(context) to register the policy
39 #
40
41 from zLOG import LOG, INFO
42
43 LOG('CPComarquage',INFO, 'Installing Product')
44
45 try:
46     import CustomizationPolicy
47 except ImportError:
48     CustomizationPolicy=None
49
50 from Globals import package_home
51 from Products.CMFCore import utils as cmfutils
52 from Products.CMFCore import DirectoryView
53 from Products.Archetypes.public import *
54 from Products.Archetypes import listTypes
55
56 import os, os.path
57
58 from Products.CPComarquage.config import *
59
60 DirectoryView.registerDirectory('skins', product_globals)
61 DirectoryView.registerDirectory('skins/cpcomarquage',
62                                     product_globals)
63
64 ##code-section custom-init-head #fill in your manual code here
65 from Products.CMFPlone import MigrationTool
66 from Products.CPComarquage.ConfigurationMethods import CPComarquageSetup
67 ##/code-section custom-init-head
68
69
70 def initialize(context):
71     ##code-section custom-init-top #fill in your manual code here
72     ##/code-section custom-init-top
73
74     # imports packages and types for registration
75
76
77     # initialize portal content
78     content_types, constructors, ftis = process_types(
79         listTypes(PROJECTNAME),
80         PROJECTNAME)
81
82     cmfutils.ContentInit(
83         PROJECTNAME + ' Content',
84         content_types      = content_types,
85         permission         = DEFAULT_ADD_CONTENT_PERMISSION,
86         extra_constructors = constructors,
87         fti                = ftis,
88         ).initialize(context)
89
90     # apply customization-policy, if theres any
91     if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'):
92         CustomizationPolicy.register(context)
93         print 'Customization policy for CPComarquage installed'
94
95     ##code-section custom-init-bottom #fill in your manual code here
96     MigrationTool.registerSetupWidget(CPComarquageSetup)
97     ##/code-section custom-init-bottom
98
Note: See TracBrowser for help on using the browser.