All pastes #344811 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-02-08 00:59 UTC
rendered paste body
# __init__.py
from Products.CMFCore.utils import ContentInit

from Products.Archetypes.public import listTypes
from Products.Archetypes.public import process_types
from Products.CMFCore.DirectoryView import registerDirectory

from Products.Application import config

registerDirectory(config.SKINS_DIR, config.GLOBALS)

def initialize(context):

    import content

    content_types, constructors, ftis = process_types(
        listTypes(config.PROJECTNAME), config.PROJECTNAME)

    all_types = zip(content_types, constructors)
    for atype, constructor in all_types:
        kind = '%s: %s' % (config.PROJECTNAME, atype.archetype_name)
        ContentInit(
            kind,
            content_types = (atype,),
            extra_constructors = (constructor,),
            fti = ftis,
        ).initialize(context)

# config.py
PROJECTNAME = 'Application'

GLOBALS = globals()

SKINS_DIR = 'skins'