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 """ Default implementation of CMFCore.
00014 
00015 $Id: __init__.py 73035 2007-03-07 16:41:03Z jens $
00016 """
00017 
00018 from Products.CMFCore.utils import ToolInit
00019 from Products.CMFCore.utils import ContentInit
00020 from Products.CMFCore.utils import registerIcon
00021 
00022 import DefaultWorkflow
00023 import DiscussionTool
00024 import Document
00025 import factory
00026 import Favorite
00027 import File
00028 import Image
00029 import Link
00030 import MembershipTool
00031 import MetadataTool
00032 import NewsItem
00033 import Portal
00034 import PropertiesTool
00035 import RegistrationTool
00036 import SkinnedFolder
00037 import SyndicationTool
00038 from permissions import AddPortalContent
00039 
00040 
00041 # Make sure security is initialized
00042 import DiscussionItem
00043 import DublinCore
00044 import utils
00045 
00046 contentConstructors = ( Document.addDocument
00047                       , File.addFile
00048                       , Image.addImage
00049                       , Link.addLink
00050                       , Favorite.addFavorite
00051                       , NewsItem.addNewsItem
00052                       , SkinnedFolder.addSkinnedFolder
00053                       )
00054 
00055 tools = ( DiscussionTool.DiscussionTool
00056         , MembershipTool.MembershipTool
00057         , RegistrationTool.RegistrationTool
00058         , PropertiesTool.PropertiesTool
00059         , MetadataTool.MetadataTool
00060         , SyndicationTool.SyndicationTool
00061         )
00062 
00063 # Register the ID to interface data for those items that don't have their 
00064 # own module
00065 from Products.CMFCore.utils import registerToolInterface
00066 from Products.GenericSetup.interfaces import ISetupTool
00067 registerToolInterface('portal_setup', ISetupTool)
00068 from Products.MailHost.interfaces import IMailHost
00069 registerToolInterface('MailHost', IMailHost)
00070 
00071 def initialize(context):
00072 
00073     ToolInit( 'CMF Default Tool'
00074             , tools=tools
00075             , icon='tool.gif'
00076             ).initialize( context )
00077 
00078     # BBB: register oldstyle constructors
00079     ContentInit( 'CMF Default Content'
00080                , content_types=()
00081                , permission=AddPortalContent
00082                , extra_constructors=contentConstructors
00083                ).initialize( context )
00084 
00085     context.registerClass( Portal.CMFSite
00086                          , constructors=(factory.addConfiguredSiteForm,
00087                                          factory.addConfiguredSite)
00088                          , icon='images/portal.gif'
00089                          )
00090 
00091     registerIcon( DefaultWorkflow.DefaultWorkflowDefinition
00092                 , 'images/workflow.gif'
00093                 , globals()
00094                 )
00095 
00096     # make registerHelp work with 2 directories
00097     help = context.getProductHelp()
00098     lastRegistered = help.lastRegistered
00099     context.registerHelp(directory='help', clear=1)
00100     context.registerHelp(directory='interfaces', clear=1)
00101     if help.lastRegistered != lastRegistered:
00102         help.lastRegistered = None
00103         context.registerHelp(directory='help', clear=1)
00104         help.lastRegistered = None
00105         context.registerHelp(directory='interfaces', clear=0)
00106     context.registerHelpTitle('CMF Default Help')