source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/__init__.py @ 3296

Last change on this file since 3296 was 3296, checked in by fenix, 12 years ago

Load Products.CacheSetup?-1.2.1 into vendor/Products.CacheSetup?/current.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1import os.path
2__version__ = open(os.path.join(__path__[0],'VERSION.txt')).read().strip()
3
4from AccessControl import allow_module
5
6from Products.Archetypes import public as atapi
7from Products.CMFCore import utils as cmfutils
8from Products.CMFCore.DirectoryView import registerDirectory
9
10from content import *
11from content.cache_tool import CacheTool
12from content.caching_policy_manager import CSCachingPolicyManager
13from permissions import initialize as initialize_permissions
14import config
15
16registerDirectory('skins', config.GLOBALS)
17
18def 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   
Note: See TracBrowser for help on using the repository browser.