root/__init__.py

Revision 4, 3.7 kB (checked in by matt_dorn@yahoo.com, 4 years ago)

0.3: Some final touch-ups before uploading

Line 
1 # File: PloneXL8.py
2 #
3 # Copyright (c) 2006 by Matt Dorn
4 # Generator: ArchGenXML Version 1.4.1
5 #            http://plone.org/products/archgenxml
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__ = """Matt Dorn <matt_dorn@yahoo.com>"""
26 __docformat__ = 'plaintext'
27
28
29 # There are three ways to inject custom code here:
30 #
31 #   - To set global configuration variables, create a file AppConfig.py.
32 #       This will be imported in config.py, which in turn is imported in
33 #       each generated class and in this file.
34 #   - To perform custom initialisation after types have been registered,
35 #       use the protected code section at the bottom of initialize().
36 #   - To register a customisation policy, create a file CustomizationPolicy.py
37 #       with a method register(context) to register the policy.
38
39 from zLOG import LOG, INFO
40
41 LOG('PloneXL8',INFO, 'Installing Product')
42
43 try:
44     import CustomizationPolicy
45 except ImportError:
46     CustomizationPolicy = None
47
48 from Globals import package_home
49 from Products.CMFCore import utils as cmfutils
50 from Products.CMFCore import CMFCorePermissions
51 from Products.CMFCore import DirectoryView
52 from Products.CMFPlone.PloneUtilities import ToolInit
53 from Products.Archetypes.atapi import *
54 from Products.Archetypes import listTypes
55 from Products.Archetypes.utils import capitalize
56
57 import os, os.path
58
59 from Products.PloneXL8.config import *
60
61 DirectoryView.registerDirectory('skins', product_globals)
62 DirectoryView.registerDirectory('skins/PloneXL8',
63                                     product_globals)
64
65 ##code-section custom-init-head #fill in your manual code here
66 ##/code-section custom-init-head
67
68
69 def initialize(context):
70     ##code-section custom-init-top #fill in your manual code here
71     ##/code-section custom-init-top
72
73     # imports packages and types for registration
74     import content
75     import tests
76
77
78     # Initialize portal content
79     all_content_types, all_constructors, all_ftis = process_types(
80         listTypes(PROJECTNAME),
81         PROJECTNAME)
82
83     cmfutils.ContentInit(
84         PROJECTNAME + ' Content',
85         content_types      = all_content_types,
86         permission         = DEFAULT_ADD_CONTENT_PERMISSION,
87         extra_constructors = all_constructors,
88         fti                = all_ftis,
89         ).initialize(context)
90
91     # Give it some extra permissions to control them on a per class limit
92     for i in range(0,len(all_content_types)):
93         klassname=all_content_types[i].__name__
94         if not klassname in ADD_CONTENT_PERMISSIONS:
95             continue
96
97         context.registerClass(meta_type   = all_ftis[i]['meta_type'],
98                               constructors= (all_constructors[i],),
99                               permission  = ADD_CONTENT_PERMISSIONS[klassname])
100
101     # Apply customization-policy, if theres any
102     if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'):
103         CustomizationPolicy.register(context)
104         print 'Customization policy for PloneXL8 installed'
105
106     ##code-section custom-init-bottom #fill in your manual code here
107     ##/code-section custom-init-bottom
108
Note: See TracBrowser for help on using the browser.