source: trunk/__init__.py @ 55

Revision 55, 2.6 KB checked in by laszlo, 14 years ago (diff)

closes #151 spent 10m

  • Property svn:eol-style set to LF
Line 
1# license ....
2
3# CMF imports
4from Products.CMFCore import utils
5from Products.CMFCore.DirectoryView import registerDirectory
6from Products.CMFPlone import MigrationTool
7from Products.CMFPlone.Portal import addPolicy, PloneGenerator
8from Products.CMFPlone.interfaces.CustomizationPolicy import ICustomizationPolicy
9from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy
10
11# Archetypes imports
12from Products.Archetypes.public import process_types, listTypes
13
14# Our own content types
15import BaseAsset, HTMLTextAsset, ImageAsset, AudioAsset
16import Module
17import SyndicatedFolder
18import Story
19import Tool
20
21# Our own portal tools
22import ToolboxSearchTool
23# Make is list of portal tools
24tools = (ToolboxSearchTool.ToolboxSearchTool,)
25
26# Our own configuration stuff
27from config import *
28from ConfigurationMethods import ToolboxSetup
29
30# Add the skins folder to the registry of viewable folders
31registerDirectory(SKINS_DIR,GLOBALS)
32
33def initialize(context):
34    """This method is called when this product is initialized upon Zope startup."""
35
36    # Add our setup widgets into MigrationTool
37    MigrationTool.registerSetupWidget(ToolboxSetup)
38
39    # Register our customization policy
40    addPolicy('Toolbox Site',ToolboxCustomizationPolicy())
41
42    # Register our set of portal tools
43    utils.ToolInit(PROJECTNAME + ' Tools', tools=tools,
44        icon='',).initialize(context)
45
46    # Process all imported content types into nice lists
47    content_types, constructors, ftis = process_types(
48        listTypes(PROJECTNAME),
49        PROJECTNAME)
50
51    # Register our set of content types
52    utils.ContentInit(
53        PROJECTNAME + ' Content',
54        content_types      = content_types,
55        permission         = ADD_CONTENT_PERMISSION,
56        extra_constructors = constructors,
57        fti                = ftis,
58        ).initialize(context)
59
60
61class ToolboxCustomizationPolicy(DefaultCustomizationPolicy):
62    """Customization policy for the Toolbox site."""
63    __implements__ = ICustomizationPolicy
64
65    # Yes, this can be used when creating a new Plone instance
66    availableAtConstruction=True
67
68    def customize(self,portal):
69        """This method is called when a Plone portal is created with this
70        customization policy."""
71       
72        # Call super class, just in case they do something intelligent
73        DefaultCustomizationPolicy.customize(self,portal)
74       
75        # Locate our migration widget
76        widget = portal.portal_migration._getWidget('Toolbox Setup')
77       
78        # Add and execute all configuration methods that it lists as being available
79        widget.addItems(widget.available())
Note: See TracBrowser for help on using the repository browser.