Back to index

plone3  3.1.7
zope2.py
Go to the documentation of this file.
00001 from Products.Archetypes import public as atapi
00002 from Products.CMFCore.permissions import setDefaultRoles
00003 import Products.Archetypes.public as atapi
00004 
00005 PROJECTNAME='wicked.atcontent'
00006 
00007 import migration
00008 
00009 def initialize(context):
00010     """load up content types"""
00011     from Products.CMFCore import utils as cmf_utils
00012     #app = context._ProductContext__app
00013     #patch_listDefaultTypeInformation(app)
00014     
00015     from ironicwiki import IronicWiki
00016     try:
00017         from wickeddoc import WickedDoc
00018     except ImportError: # no ATCT
00019         pass
00020 
00021     types = atapi.listTypes(PROJECTNAME)
00022     content_types, constructors, ftis = atapi.process_types( types,
00023                                                              PROJECTNAME)
00024     permissions = {}
00025     types = atapi.listTypes(PROJECTNAME)
00026 
00027     for atype in  types:
00028         permission = "%s: Add %s" % (PROJECTNAME, atype['portal_type'])
00029         permissions[atype['portal_type']] = permission
00030 
00031         # Assign default roles
00032         setDefaultRoles(permission, ('Manager', 'Owner'))
00033     
00034     allTypes = zip(content_types, constructors)
00035     for atype, constructor in allTypes:
00036         kind = "%s: %s" % (PROJECTNAME, atype.archetype_name)
00037         cmf_utils.ContentInit(
00038             kind,
00039             content_types      = (atype,),
00040             permission         = permissions[atype.portal_type],
00041             extra_constructors = (constructor,),
00042             fti                = ftis,
00043             ).initialize(context)