1 | import os.path |
---|
2 | __version__ = open(os.path.join(__path__[0],'VERSION.txt')).read().strip() |
---|
3 | |
---|
4 | from AccessControl import allow_module |
---|
5 | |
---|
6 | from Products.Archetypes import public as atapi |
---|
7 | from Products.CMFCore import utils as cmfutils |
---|
8 | from Products.CMFCore.DirectoryView import registerDirectory |
---|
9 | |
---|
10 | from content import * |
---|
11 | from content.cache_tool import CacheTool |
---|
12 | from content.caching_policy_manager import CSCachingPolicyManager |
---|
13 | from permissions import initialize as initialize_permissions |
---|
14 | import config |
---|
15 | |
---|
16 | registerDirectory('skins', config.GLOBALS) |
---|
17 | |
---|
18 | def initialize(context): |
---|
19 | """Product Initialization |
---|
20 | """ |
---|
21 | import patch, patch_cmf, patch_five |
---|
22 | patch.run() |
---|
23 | patch_cmf.run() |
---|
24 | patch_five.run() |
---|
25 | |
---|
26 | tools = (CacheTool, CSCachingPolicyManager) |
---|
27 | |
---|
28 | try: |
---|
29 | cmfutils.ToolInit( |
---|
30 | config.PROJECT_NAME + ' Tool', |
---|
31 | tools = tools, |
---|
32 | icon = 'cachesetup_tool_icon.gif', |
---|
33 | ).initialize(context) |
---|
34 | except TypeError: |
---|
35 | cmfutils.ToolInit( |
---|
36 | config.PROJECT_NAME + ' Tool', |
---|
37 | tools = tools, |
---|
38 | product_name = config.PROJECT_NAME, |
---|
39 | icon = 'cachesetup_tool_icon.gif', |
---|
40 | ).initialize(context) |
---|
41 | |
---|
42 | allow_module('Products.CacheSetup.config') |
---|
43 | |
---|
44 | # Ask Archetypes to handback all the type information needed |
---|
45 | # to make the CMF happy. |
---|
46 | types = atapi.listTypes(config.PROJECT_NAME) |
---|
47 | content_types, constructors, ftis = \ |
---|
48 | atapi.process_types(types, config.PROJECT_NAME) |
---|
49 | permissions = initialize_permissions() |
---|
50 | |
---|
51 | # We want to register each each type with its own permission, |
---|
52 | # this will afford us greater control during system |
---|
53 | # configuration/deployment (and is a good recipe) |
---|
54 | # The pattern used here will create many item options in ZMI |
---|
55 | # menus, but is the only way that allows for things to still be |
---|
56 | # selectable in the UI. If they all had the same name, only the |
---|
57 | # first would be found. |
---|
58 | permissions = initialize_permissions() |
---|
59 | allTypes = zip(content_types, constructors) |
---|
60 | for atype, constructor in allTypes: |
---|
61 | cmfutils.ContentInit( |
---|
62 | atype.meta_type, |
---|
63 | content_types = (atype,), |
---|
64 | permission = permissions[atype.portal_type], |
---|
65 | extra_constructors = (constructor,), |
---|
66 | fti = ftis, |
---|
67 | ).initialize(context) |
---|
68 | |
---|