vendor/CMF/1.6.3/CMFCore

view __init__.py @ 2:4c712d7bd1d7

Added tag 1.6.3 for changeset 1babb9d61518
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Fri, 09 Sep 2011 12:44:00 +0200
parents
children
line source
1 ##############################################################################
2 #
3 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
4 #
5 # This software is subject to the provisions of the Zope Public License,
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10 # FOR A PARTICULAR PURPOSE.
11 #
12 ##############################################################################
13 """ Portal services base objects
15 $Id$
16 """
18 from sys import modules
20 import PortalObject, PortalContent, PortalFolder
21 import MembershipTool, WorkflowTool, CatalogTool, DiscussionTool
22 import ActionsTool, UndoTool, RegistrationTool, SkinsTool
23 import MemberDataTool, TypesTool
24 import URLTool
25 import DirectoryView, FSImage, FSFile, FSPropertiesObject
26 import FSDTMLMethod, FSPythonScript, FSSTXMethod
27 import FSPageTemplate
28 import FSZSQLMethod
29 import CookieCrumbler
30 import ContentTypeRegistry
31 import CachingPolicyManager
32 import utils
34 from permissions import AddPortalFolders
37 # Old name that some third-party packages may need.
38 ADD_FOLDERS_PERMISSION = AddPortalFolders
39 HAS_PAGE_TEMPLATES = 1
41 bases = (
42 PortalObject.PortalObjectBase,
43 PortalFolder.PortalFolder,
44 PortalContent.PortalContent,
45 )
47 tools = (
48 MembershipTool.MembershipTool,
49 RegistrationTool.RegistrationTool,
50 WorkflowTool.WorkflowTool,
51 CatalogTool.CatalogTool,
52 DiscussionTool.DiscussionTool,
53 ActionsTool.ActionsTool,
54 UndoTool.UndoTool,
55 SkinsTool.SkinsTool,
56 MemberDataTool.MemberDataTool,
57 TypesTool.TypesTool,
58 URLTool.URLTool,
59 )
61 this_module = modules[ __name__ ]
63 z_bases = utils.initializeBasesPhase1(bases, this_module)
64 z_tool_bases = utils.initializeBasesPhase1(tools, this_module)
66 FolderConstructorForm = ( 'manage_addPortalFolderForm'
67 , PortalFolder.manage_addPortalFolderForm
68 )
70 cmfcore_globals=globals()
72 _CONTENT_TYPES = ( PortalFolder.PortalFolder, )
73 _EXTRA_CONSTRUCTORS = ( PortalFolder.manage_addPortalFolder, )
74 _FTI = PortalFolder.factory_type_information
77 # BBB / FFF: We provide CMFBTreeFolder IFF the BTreeFolder2 product is
78 # available, which it is by default in Zope 2.8.0.
79 try:
80 import Products.BTreeFolder2
81 except ImportError:
82 pass
83 else:
84 # Because persistent objects may be out there which were
85 # created when the module was in that product, we need
86 # __module_aliases__ .
87 __module_aliases__ = ( ( 'Products.BTreeFolder2.CMFBTreeFolder'
88 , 'Products.CMFCore.CMFBTreeFolder'
89 )
90 ,
91 )
92 import CMFBTreeFolder
93 _CONTENT_TYPES += ( CMFBTreeFolder.CMFBTreeFolder, )
94 _EXTRA_CONSTRUCTORS += ( CMFBTreeFolder.manage_addCMFBTreeFolder, )
95 _FTI += CMFBTreeFolder.factory_type_information
97 def initialize(context):
99 utils.initializeBasesPhase2(z_bases, context)
100 utils.initializeBasesPhase2(z_tool_bases, context)
102 context.registerClass(
103 DirectoryView.DirectoryView,
104 constructors=(('manage_addDirectoryViewForm',
105 DirectoryView.manage_addDirectoryViewForm),
106 DirectoryView.manage_addDirectoryView,
107 DirectoryView.manage_listAvailableDirectories,
108 ),
109 icon='images/dirview.gif'
110 )
112 context.registerClass(
113 CookieCrumbler.CookieCrumbler,
114 constructors=(CookieCrumbler.manage_addCCForm,
115 CookieCrumbler.manage_addCC),
116 icon = 'images/cookie.gif'
117 )
119 context.registerClass(
120 ContentTypeRegistry.ContentTypeRegistry,
121 constructors=( ContentTypeRegistry.manage_addRegistry, ),
122 icon = 'images/registry.gif'
123 )
125 context.registerClass(
126 CachingPolicyManager.CachingPolicyManager,
127 constructors=( CachingPolicyManager.manage_addCachingPolicyManager, ),
128 icon = 'images/registry.gif'
129 )
131 utils.registerIcon(TypesTool.FactoryTypeInformation,
132 'images/typeinfo.gif', globals())
133 utils.registerIcon(TypesTool.ScriptableTypeInformation,
134 'images/typeinfo.gif', globals())
135 utils.registerIcon(FSDTMLMethod.FSDTMLMethod,
136 'images/fsdtml.gif', globals())
137 utils.registerIcon(FSPythonScript.FSPythonScript,
138 'images/fspy.gif', globals())
139 utils.registerIcon(FSImage.FSImage,
140 'images/fsimage.gif', globals())
141 utils.registerIcon(FSFile.FSFile,
142 'images/fsfile.gif', globals())
143 utils.registerIcon(FSPageTemplate.FSPageTemplate,
144 'images/fspt.gif', globals())
145 utils.registerIcon(FSPropertiesObject.FSPropertiesObject,
146 'images/fsprops.gif', globals())
147 utils.registerIcon(FSZSQLMethod.FSZSQLMethod,
148 'images/fssqlmethod.gif', globals())
149 utils.registerIcon(TypesTool.FactoryTypeInformation,
150 'images/typeinfo.gif', globals())
151 utils.registerIcon(TypesTool.ScriptableTypeInformation,
152 'images/typeinfo.gif', globals())
154 utils.ToolInit( 'CMF Core Tool'
155 , tools=tools
156 , icon='tool.gif'
157 ).initialize( context )
159 utils.ContentInit( 'CMF Core Content'
160 , content_types=_CONTENT_TYPES
161 , permission=AddPortalFolders
162 , extra_constructors=_EXTRA_CONSTRUCTORS
163 , fti=_FTI
164 ).initialize( context )
166 # make registerHelp work with 2 directories
167 help = context.getProductHelp()
168 lastRegistered = help.lastRegistered
169 context.registerHelp(directory='help', clear=1)
170 context.registerHelp(directory='interfaces', clear=1)
171 if help.lastRegistered != lastRegistered:
172 help.lastRegistered = None
173 context.registerHelp(directory='help', clear=1)
174 help.lastRegistered = None
175 context.registerHelp(directory='interfaces', clear=0)
176 context.registerHelpTitle('CMF Core Help')