root/__init__.py

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

Initial import

Line 
1 #
2 # Initialise the product's module. There are three ways to inject custom code
3 # here:
4 #
5 #   - To set global configuration variables, create a file AppConfig.py. This
6 #       will be imported in config.py, which in turn is imported in each
7 #       generated class and in this file.
8 #   - To perform custom initialisation after types have been registered, use
9 #       the protected code section at the bottom of initialize().
10 #   - To register a customisation policy, create a file CustomizationPolicy.py
11 #       with a method register(context) to register the policy
12 #
13
14 from zLOG import LOG, INFO
15
16 LOG('PloneXL8',INFO, 'Installing Product')
17
18 try:
19     import CustomizationPolicy
20 except ImportError:
21     CustomizationPolicy=None
22
23 from Globals import package_home
24 from Products.CMFCore import utils as cmfutils
25 from Products.CMFCore import CMFCorePermissions
26 from Products.CMFCore import DirectoryView
27 from Products.CMFPlone.PloneUtilities import ToolInit
28 from Products.Archetypes.public import *
29 from Products.Archetypes import listTypes
30 from Products.Archetypes.utils import capitalize
31
32 import os, os.path
33
34 from Products.PloneXL8.config import *
35
36 DirectoryView.registerDirectory('skins', product_globals)
37 DirectoryView.registerDirectory('skins/PloneXL8',
38                                     product_globals)
39
40 ##code-section custom-init-head #fill in your manual code here
41 ##/code-section custom-init-head
42
43
44 def initialize(context):
45     ##code-section custom-init-top #fill in your manual code here
46     ##/code-section custom-init-top
47
48     # imports packages and types for registration
49
50     import TranslationDoc
51     import TranslationCenter
52
53     # initialize portal content
54     all_content_types, all_constructors, all_ftis = process_types(
55         listTypes(PROJECTNAME),
56         PROJECTNAME)
57
58     cmfutils.ContentInit(
59         PROJECTNAME + ' Content',
60         content_types      = all_content_types,
61         permission         = DEFAULT_ADD_CONTENT_PERMISSION,
62         extra_constructors = all_constructors,
63         fti                = all_ftis,
64         ).initialize(context)
65
66     # give it some extra permissions to control them on a per class limit
67     for i in range(0,len(all_content_types)):
68         klassname=all_content_types[i].__name__
69         if not klassname in ADD_CONTENT_PERMISSIONS:
70             continue
71
72         context.registerClass(meta_type   = all_ftis[i]['meta_type'],
73                               constructors= (all_constructors[i],),
74                               permission  = ADD_CONTENT_PERMISSIONS[klassname])
75
76     # apply customization-policy, if theres any
77     if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'):
78         CustomizationPolicy.register(context)
79         print 'Customization policy for PloneXL8 installed'
80
81     ##code-section custom-init-bottom #fill in your manual code here
82     ##/code-section custom-init-bottom
83
Note: See TracBrowser for help on using the browser.