Back to index

plone3  3.1.7
__init__.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ Portal services base objects
00014 
00015 $Id: __init__.py 73035 2007-03-07 16:41:03Z jens $
00016 """
00017 
00018 try:
00019     import five.localsitemanager
00020 except ImportError, e:
00021     import sys
00022     import os
00023     sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
00024     import five.localsitemanager
00025 
00026 import PortalFolder
00027 import MembershipTool, WorkflowTool, CatalogTool, DiscussionTool
00028 import ActionsTool, UndoTool, RegistrationTool, SkinsTool
00029 import MemberDataTool, TypesTool
00030 import URLTool
00031 import fiveactionstool
00032 import DirectoryView, FSImage, FSFile, FSPropertiesObject
00033 import FSDTMLMethod, FSPythonScript
00034 import FSPageTemplate
00035 import FSZSQLMethod
00036 import ActionInformation
00037 import CookieCrumbler
00038 import ContentTypeRegistry
00039 import CachingPolicyManager
00040 import CMFBTreeFolder
00041 import utils
00042 from permissions import AddPortalFolders
00043 
00044 
00045 # Make sure security is initialized
00046 import FSReSTMethod
00047 import FSSTXMethod
00048 import PortalContent
00049 import PortalObject
00050 
00051 tools = (
00052     MembershipTool.MembershipTool,
00053     RegistrationTool.RegistrationTool,
00054     WorkflowTool.WorkflowTool,
00055     CatalogTool.CatalogTool,
00056     DiscussionTool.DiscussionTool,
00057     ActionsTool.ActionsTool,
00058     UndoTool.UndoTool,
00059     SkinsTool.SkinsTool,
00060     MemberDataTool.MemberDataTool,
00061     TypesTool.TypesTool,
00062     URLTool.URLTool,
00063     fiveactionstool.FiveActionsTool,
00064     )
00065 
00066 # BBB: oldstyle constructors
00067 _EXTRA_CONSTRUCTORS = (PortalFolder.manage_addPortalFolder,
00068                        CMFBTreeFolder.manage_addCMFBTreeFolder)
00069 
00070 # Because persistent objects may be out there which were
00071 # created when the module was in that product, we need
00072 # __module_aliases__ . 
00073 __module_aliases__ = ( ( 'Products.BTreeFolder2.CMFBTreeFolder'
00074                        , 'Products.CMFCore.CMFBTreeFolder'
00075                        )
00076                      ,
00077                      )
00078 
00079 def initialize(context):
00080     context.registerClass(
00081         DirectoryView.DirectoryView,
00082         constructors=(('manage_addDirectoryViewForm',
00083                        DirectoryView.manage_addDirectoryViewForm),
00084                       DirectoryView.manage_addDirectoryView,
00085                       DirectoryView.manage_listAvailableDirectories,
00086                       ),
00087         icon='images/dirview.gif'
00088         )
00089 
00090     context.registerClass(
00091         CookieCrumbler.CookieCrumbler,
00092         constructors=(CookieCrumbler.manage_addCCForm,
00093                       CookieCrumbler.manage_addCC),
00094         icon = 'images/cookie.gif'
00095         )
00096 
00097     context.registerClass(
00098         ContentTypeRegistry.ContentTypeRegistry,
00099         constructors=( ContentTypeRegistry.manage_addRegistry, ),
00100         icon = 'images/registry.gif'
00101         )
00102 
00103     context.registerClass(
00104         CachingPolicyManager.CachingPolicyManager,
00105         constructors=( CachingPolicyManager.manage_addCachingPolicyManager, ),
00106         icon = 'images/registry.gif'
00107         )
00108 
00109     utils.registerIcon(ActionInformation.ActionCategory,
00110                        'images/cmf_action_category.gif', globals())
00111     utils.registerIcon(ActionInformation.Action,
00112                        'images/cmf_action.gif', globals())
00113     utils.registerIcon(TypesTool.FactoryTypeInformation,
00114                        'images/typeinfo.gif', globals())
00115     utils.registerIcon(TypesTool.ScriptableTypeInformation,
00116                        'images/typeinfo.gif', globals())
00117     utils.registerIcon(FSDTMLMethod.FSDTMLMethod,
00118                        'images/fsdtml.gif', globals())
00119     utils.registerIcon(FSPythonScript.FSPythonScript,
00120                        'images/fspy.gif', globals())
00121     utils.registerIcon(FSImage.FSImage,
00122                        'images/fsimage.gif', globals())
00123     utils.registerIcon(FSFile.FSFile,
00124                        'images/fsfile.gif', globals())
00125     utils.registerIcon(FSPageTemplate.FSPageTemplate,
00126                        'images/fspt.gif', globals())
00127     utils.registerIcon(FSPropertiesObject.FSPropertiesObject,
00128                        'images/fsprops.gif', globals())
00129     utils.registerIcon(FSZSQLMethod.FSZSQLMethod,
00130                        'images/fssqlmethod.gif', globals())
00131 
00132     utils.ToolInit( 'CMF Core Tool'
00133                   , tools=tools
00134                   , icon='tool.gif'
00135                   ).initialize( context )
00136 
00137     # BBB: register oldstyle constructors
00138     utils.ContentInit( 'CMF Core Content'
00139                      , content_types=()
00140                      , permission=AddPortalFolders
00141                      , extra_constructors=_EXTRA_CONSTRUCTORS
00142                      ).initialize( context )
00143 
00144     # make registerHelp work with 2 directories
00145     help = context.getProductHelp()
00146     lastRegistered = help.lastRegistered
00147     context.registerHelp(directory='help', clear=1)
00148     context.registerHelp(directory='interfaces', clear=1)
00149     if help.lastRegistered != lastRegistered:
00150         help.lastRegistered = None
00151         context.registerHelp(directory='help', clear=1)
00152         help.lastRegistered = None
00153         context.registerHelp(directory='interfaces', clear=0)
00154     context.registerHelpTitle('CMF Core Help')