Back to index

plone3  3.1.7
__init__.py
Go to the documentation of this file.
00001 import os.path
00002 __version__ = open(os.path.join(__path__[0], 'version.txt')).read().strip()
00003 
00004 import sys
00005 import bbb
00006 
00007 from Products.Archetypes.config import *
00008 from Products.Archetypes.utils import DisplayList
00009 
00010 from AccessControl import ModuleSecurityInfo
00011 from AccessControl import allow_class, allow_module
00012 from Products.CMFCore import permissions
00013 
00014 ###
00015 ## security
00016 ###
00017 # make log and log_exc public
00018 allow_module('Products.Archetypes.utils')
00019 
00020 ModuleSecurityInfo('Products.Archetypes.debug').declarePublic('log')
00021 ModuleSecurityInfo('Products.Archetypes.debug').declarePublic('log_exc')
00022 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declarePublic('getAllowableContentTypes')
00023 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declarePublic('getAllowedContentTypes')
00024 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declarePublic('getForbiddenContentTypes')
00025 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declarePublic('getDefaultContentType')
00026 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declareProtected(permissions.ManagePortal, 'setForbiddenContentTypes')
00027 ModuleSecurityInfo('Products.Archetypes.mimetype_utils').declareProtected(permissions.ManagePortal, 'setDefaultContentType')
00028 
00029 # Plone compatibility in plain CMF. Templates should use IndexIterator from
00030 # Archetypes and not from CMFPlone
00031 from PloneCompat import IndexIterator
00032 allow_class(IndexIterator)
00033 
00034 from PloneCompat import transaction_note
00035 ModuleSecurityInfo('Products.Archetypes').declarePublic('transaction_note')
00036 
00037 # Import "PloneMessageFactory as _" to create messages in plone domain
00038 # duplicated here so we don't add a dependency on CMFPlone
00039 from zope.i18nmessageid import MessageFactory
00040 PloneMessageFactory = MessageFactory('plone')
00041 ModuleSecurityInfo('Products.Archetypes').declarePublic('PloneMessageFactory')
00042 
00043 # make DisplayList accessible from python scripts and others objects executed
00044 # in a restricted environment
00045 allow_class(DisplayList)
00046 
00047 # Allow import of NotFound exception
00048 ModuleSecurityInfo('zExceptions').declarePublic('NotFound')
00049 
00050 ###
00051 # register tools and content types
00052 ###
00053 from Products.Archetypes.ArchetypeTool import \
00054     process_types, listTypes, fixAfterRenameType
00055 from Products.Archetypes.ArchetypeTool import ArchetypeTool
00056 ATToolModule = sys.modules[ArchetypeTool.__module__] # mpf :|
00057 from Products.Archetypes.ArchTTWTool import ArchTTWTool
00058 from Products.Archetypes.ReferenceEngine import ReferenceCatalog as RefTool
00059 from Products.Archetypes.UIDCatalog import UIDCatalog as UIDTool
00060 
00061 
00062 tools = (
00063     ArchetypeTool,
00064     ArchTTWTool,
00065     RefTool,
00066     UIDTool,
00067     )
00068 
00069 types_globals=globals()
00070 
00071 def initialize(context):
00072     from Products.CMFCore import utils
00073 
00074     utils.ToolInit("%s Tool" % PKG_NAME, tools=tools,
00075                    icon="tool.gif",
00076                    ).initialize(context)
00077 
00078     if REGISTER_DEMO_TYPES:
00079         import Products.Archetypes.examples
00080 
00081         content_types, constructors, ftis = process_types(
00082             listTypes(PKG_NAME), PKG_NAME)
00083 
00084         utils.ContentInit(
00085             '%s Content' % PKG_NAME,
00086             content_types = content_types,
00087             permission = permissions.AddPortalContent,
00088             extra_constructors = constructors,
00089             fti = ftis,
00090             ).initialize(context)
00091     try:
00092         from Products.CMFCore.FSFile import FSFile
00093         from Products.CMFCore.DirectoryView import registerFileExtension
00094         registerFileExtension('xsl', FSFile)
00095         registerFileExtension('xul', FSFile)
00096     except ImportError:
00097         pass