Esempio n. 1
0
def initialize(context):
    """ Zope 2
    """

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes(PROJECTNAME), PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=all_content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if klassname not in ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(meta_type=all_ftis[i]['meta_type'],
                              constructors=(all_constructors[i], ),
                              permission=ADD_CONTENT_PERMISSIONS[klassname])

    setupSchemas()
Esempio n. 2
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    logger.info("*** Initializing BHP LIMS Customization Package ***")

    from content.courier import Courier  # noqa
    from content.couriers import Couriers  # noqa

    from bhp.lims.content.barcodeprinter import BarcodePrinter  # noqa
    from bhp.lims.controlpanel.barcodeprinters import BarcodePrinters  # noqa

    types = listTypes(PRODUCT_NAME)
    content_types, constructors, ftis = process_types(types, PRODUCT_NAME)

    # Register each type with it's own Add permission
    # use ADD_CONTENT_PERMISSION as default
    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: Add %s" % (PRODUCT_NAME, atype.portal_type)
        ContentInit(
            kind,
            content_types=(atype, ),
            permission=AddPortalContent,
            extra_constructors=(constructor, ),
            fti=ftis,
        ).initialize(context)
def initialize(context):

    from Products.CompositePack import viewlet
    from Products.CompositePack.composite import archetype
    from Products.CompositePack.composite import fragments
    from Products.CompositePack.composite import navigationpage
    from Products.CompositePack.composite import portlets
    from Products.CompositePack.composite import titles
    from Products.CompositePack.viewlet import container

    if config.INSTALL_DEMO_TYPES:
        from Products.CompositePack.demo import ATCompositeDocument

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

    utils.ContentInit(
            "%s Content" % config.PROJECTNAME,
            content_types=content_types,
            permission=config.ADD_CONTENT_PERMISSION,
            extra_constructors=constructors,
            fti=ftis,
            ).initialize(context)

    utils.ToolInit(config.TOOL_NAME,
            tools=tools,
            icon=config.TOOL_ICON,
            ).initialize(context)
Esempio n. 4
0
def initialize(context):
    """Intializer called when used as a Zope 2 product."""

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + " Content",
        content_types=all_content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if not klassname in ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(
            meta_type=all_ftis[i]["meta_type"],
            constructors=(all_constructors[i],),
            permission=ADD_CONTENT_PERMISSIONS[klassname],
        )
Esempio n. 5
0
def initialize(context):
    """ Zope 2
    """


    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes(PROJECTNAME),
        PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=all_content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if klassname not in ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(meta_type=all_ftis[i]['meta_type'],
                              constructors=(all_constructors[i],),
                              permission=ADD_CONTENT_PERMISSIONS[klassname])

    setupSchemas()
Esempio n. 6
0
def initialize(context):
    ""

    from content.country import Country
    from content.region import Region
    from controlpanel.bika_cultivars import Cultivars
    from content.cultivar import Cultivar
    from controlpanel.bika_regions import Regions
    from controlpanel.bika_winetypes import WineTypes
    from content.winetype import WineType
    from controlpanel.bika_transportconditions import TransportConditions
    from content.transportcondition import TransportCondition
    from controlpanel.bika_storageconditions import StorageConditions
    from content.storagecondition import StorageCondition

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

    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type)
        perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type,
                                           ADD_CONTENT_PERMISSION)
        ContentInit(
            kind,
            content_types=(atype, ),
            permission=perm,
            extra_constructors=(constructor, ),
            fti=ftis,
        ).initialize(context)
Esempio n. 7
0
def initialize(context):

    # from Products.validation import validation
    # validation.register(validators.CourseNumberValidator('CourseNumberValidator'))

    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, ),
        ).initialize(context)
Esempio n. 8
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    logger.info("*** Initializing SENAITE QUEUE Customization package ***")

    types = listTypes(PRODUCT_NAME)
    content_types, constructors, ftis = process_types(types, PRODUCT_NAME)

    # Register each type with it's own Add permission
    # use ADD_CONTENT_PERMISSION as default
    all_types = zip(content_types, constructors)
    for a_type, constructor in all_types:
        kind = "%s: Add %s" % (PRODUCT_NAME, a_type.portal_type)
        ContentInit(
            kind,
            content_types=(a_type, ),
            permission=AddPortalContent,
            extra_constructors=(constructor, ),
            fti=ftis,
        ).initialize(context)

    # Register Queue's PAS plugin
    from pasplugin import QueueAuthPlugin
    PluggableAuthService.registerMultiPlugin(QueueAuthPlugin.meta_type)
    context.registerClass(
        QueueAuthPlugin,
        permission=manage_users,
        constructors=(add_queue_auth_plugin, ),
    )
Esempio n. 9
0
def initialize(context):
    """ initializer called when used as a zope2 product """

    # setup non-anonymous file uploads
    from plone.app.blob import monkey
    monkey.__name__     # make pyflakes happy...

    # initialize portal content
    from plone.app.blob import content
    content.__name__    # make pyflakes happy...

    from Products.CMFCore import utils
    from Products.Archetypes import atapi
    from Products.ATContentTypes import permission as atct

    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes(packageName), packageName)
    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit("%s: %s" % (packageName, atype.portal_type),
            content_types = (atype,),
            permission = permissions[atype.portal_type],
            extra_constructors = (constructor,),
            ).initialize(context)

    replacement_types = (
        ('File', content.addATBlobFile),
        ('Image', content.addATBlobImage),
    )
    for name, constructor in replacement_types:
        utils.ContentInit("%s: %s" % (packageName, name),
            content_types = (content.ATBlob,),
            permission = atct.permissions.get(name),
            extra_constructors = (constructor,),
            ).initialize(context)
Esempio n. 10
0
def initialize(context):
    """Initializer called when used as a Zope 2 product.

    This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
    is necessary for GenericSetup profiles to work, for example.

    Here, we call the Archetypes machinery to register our content types
    with Zope and the CMF.
    """

    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, ),
        ).initialize(context)
def initialize(context):
    """Initializer called when used as a Zope 2 product.

    This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
    is necessary for GenericSetup profiles to work, for example.

    Here, we call the Archetypes machinery to register our content types
    with Zope and the CMF.
    """

    from content.intranetfolder import IntranetFolder  # noqa

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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
                    content_types=(atype, ),
                    permission=config.ADD_PERMISSIONS[atype.portal_type],
                    extra_constructors=(constructor,),
                    ).initialize(context)
Esempio n. 12
0
def initialize(context):
    """initialize product (called by zope)"""

    # import packages and types for registration
    # I really don't think I have to do these imports.
    from content import Subsite
    from content import CountySite
    from content import Section
    from content import Blog
    from content import HomePage
    from content import Newsletter
    from content import PhotoFolder
    from content import FormConfirmationPage

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

    # Initialize the various content types
    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit("%s: %s" % (config.PROJECTNAME, 
            atype.portal_type),
            content_types = (atype,),
            permission = config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors = (constructor,),
            ).initialize(context)
Esempio n. 13
0
def initialize(context):
    """initialize product (called by zope)"""

    # imports packages and types for registration
    from . import content
    content  # pyflakes

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes(PROJECTNAME), PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=all_content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if not klassname in ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(meta_type=all_ftis[i]['meta_type'],
                              constructors=(all_constructors[i], ),
                              permission=ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context):
    """Initializer called when used as a Zope 2 product.

    This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
    is necessary for GenericSetup profiles to work, for example.

    Here, we call the Archetypes machinery to register our content types
    with Zope and the CMF.
    """

    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,),
            ).initialize(context)
Esempio n. 15
0
def gen_class(klass, schema=None):
    """generats and registers the klass
    """
    if schema is not None:
        klass.schema = schema.copy()
    registerType(klass, 'Archetypes')
    content_types, constructors, ftis = process_types(listTypes(), PKG_NAME)
Esempio n. 16
0
def initialize(context):
    # Importing the content types allows for their registration
    # with the Archetypes runtime
    import content
    import tools
    
    types = listTypes(PROJECTNAME)
    content_types, constructors, ftis = \
       process_types(types, PROJECTNAME)
    
    tools=[tools.admanager.AdManager, tools.adcatalog.AdCatalog]
    cmf_utils.ToolInit(PROJECTNAME+' Tools',
                tools = tools,
                icon='tool.gif'
                ).initialize(context)

    permissions = initialize_permissions()
    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
       kind = "%s: %s" % (PROJECTNAME, atype.archetype_name)
       cmf_utils.ContentInit(
           kind,
           content_types      = (atype,),
           permission         = permissions[atype.portal_type],
           extra_constructors = (constructor,),
           fti                = ftis,
           ).initialize(context)
    registerClasses(context, PROJECTNAME)
Esempio n. 17
0
def initialize(context):
    """ initializer called when used as a zope2 product """

    try:
        from Products.Archetypes import atapi
        from plone.app.folder import folder
    except ImportError:
        pass
    else:
        from Products.CMFCore import utils

        folder.__name__    # make pyflakes happy...

        content_types, constructors, ftis = atapi.process_types(
            atapi.listTypes(packageName), packageName)

        assert len(content_types) == 1, 'only one new folder, please!'

        for atype, constructor, fti in zip(content_types, constructors, ftis):
            utils.ContentInit('%s: %s' % (packageName, atype.portal_type),
                content_types = (atype,),
                permission = AddFolder,
                extra_constructors = (constructor,),
                fti = (fti,),
                ).initialize(context)

    from plone.app.folder import nogopip

    context.registerClass(nogopip.GopipIndex,
        permission = 'Add Pluggable Index',
        constructors = (nogopip.manage_addGopipForm,
                        nogopip.manage_addGopipIndex),
        icon = 'www/index.gif',
        visibility = None)
Esempio n. 18
0
def initialize(context):
    enable_log()
    if os.environ.get('ZOPETESTCASE') is None:
        pwManager = getUtility(IPasswordManager, 'pg')
        dbHostname = os.environ.get('PG_HOSTNAME', 'localhost')
        connString = 'postgres://%s@%s/gites_wallons' % \
            (pwManager.getLoginPassWithSeparator(':'), dbHostname)
        createSAWrapper(connString,
                        forZope=True,
                        echo=False,
                        session_options={'query_cls': query_callable(regions)},
                        engine_options={'convert_unicode': True,
                                        'encoding': 'utf-8'},
                        encoding='utf-8',
                        name='gites_wallons',
                        model='GitesMappings')

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

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=constructors,
        fti=ftis).initialize(context)
Esempio n. 19
0
def initialize(context):
    ""

    from content.country import Country
    from content.region import Region
    from controlpanel.bika_cultivars import Cultivars
    from content.cultivar import Cultivar
    from controlpanel.bika_regions import Regions
    from controlpanel.bika_winetypes import WineTypes
    from content.winetype import WineType
    from controlpanel.bika_transportconditions import TransportConditions
    from content.transportcondition import TransportCondition
    from controlpanel.bika_storageconditions import StorageConditions
    from content.storagecondition import StorageCondition

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

    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type)
        perm = ADD_CONTENT_PERMISSIONS.get(
            atype.portal_type, ADD_CONTENT_PERMISSION)
        ContentInit(kind,
                    content_types=(atype,),
                    permission = perm,
                    extra_constructors = (constructor,),
                    fti = ftis,
                    ).initialize(context)
Esempio n. 20
0
def initialize(context):
    """ initializer called when used as a zope2 product """

    try:
        from Products.Archetypes import atapi
        from plone.app.folder import folder
    except ImportError:
        pass
    else:
        from Products.CMFCore import utils

        folder.__name__  # make pyflakes happy...

        content_types, constructors, ftis = atapi.process_types(
            atapi.listTypes(packageName), packageName)

        assert len(content_types) == 1, 'only one new folder, please!'

        for atype, constructor, fti in zip(content_types, constructors, ftis):
            utils.ContentInit(
                '%s: %s' % (packageName, atype.portal_type),
                content_types=(atype, ),
                permission=AddFolder,
                extra_constructors=(constructor, ),
                fti=(fti, ),
            ).initialize(context)

    from plone.app.folder import nogopip

    context.registerClass(nogopip.GopipIndex,
                          permission='Add Pluggable Index',
                          constructors=(nogopip.manage_addGopipForm,
                                        nogopip.manage_addGopipIndex),
                          icon='www/index.gif',
                          visibility=None)
Esempio n. 21
0
def initialize(context):

    from Products.CompositePack import viewlet
    from Products.CompositePack.composite import archetype
    from Products.CompositePack.composite import fragments
    from Products.CompositePack.composite import navigationpage
    from Products.CompositePack.composite import portlets
    from Products.CompositePack.composite import titles
    from Products.CompositePack.viewlet import container

    if config.INSTALL_DEMO_TYPES:
        from Products.CompositePack.demo import ATCompositeDocument

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

    utils.ContentInit(
        "%s Content" % config.PROJECTNAME,
        content_types=content_types,
        permission=config.ADD_CONTENT_PERMISSION,
        extra_constructors=constructors,
        fti=ftis,
    ).initialize(context)

    utils.ToolInit(
        config.TOOL_NAME,
        tools=tools,
        icon=config.TOOL_ICON,
    ).initialize(context)
Esempio n. 22
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    # imports packages and types for registration
    import content
    content  # pyflakes
    permissions = dict(
        Project='minaraad.projects: Add Project',
        Meeting='minaraad.projects: Add Meeting',
        DigiBib='minaraad.projects: Add DigiBib',
        AgendaItemProject='minaraad.projects: Add AgendaItemProject',
        Organisation='minaraad.projects: Add Organisation',
        ProjectContainer='minaraad.projects: Add ProjectContainer',
        MeetingContainer='minaraad.projects: Add MeetingContainer',
        OrganisationContainer='minaraad.projects: Add OrganisationContainer',
    )

    # Initialize portal content
    content_types, constructors, ftis = atapi.process_types(
        listTypes(config.PROJECTNAME),
        config.PROJECTNAME)

    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: %s" % (config.PROJECTNAME, atype.archetype_name)
        cmfutils.ContentInit(
            kind,
            content_types=(atype, ),
            permission=permissions[atype.portal_type],
            extra_constructors=(constructor, ),
        ).initialize(context)
Esempio n. 23
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

    #from pmr2.app.workspace import content
    from pmr2.app.workspace.pas import protocol

    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes('pmr2.app.workspace'), 'pmr2.app.workspace')

    cmfutils.ContentInit(
        'pmr2.app.workspace Content',
        content_types = content_types,
        permission = ADD_CONTENT_PERMISSION,
        extra_constructors = constructors,
        fti = ftis,
        ).initialize(context)

    registerMultiPlugin(protocol.ProtocolAuthPlugin.meta_type)

    context.registerClass(
        protocol.ProtocolAuthPlugin,
        constructors = (
            #protocol.manage_addProtocolAuthPluginForm,
            protocol.addProtocolAuthPlugin,
        ),
        visibility = None
    )
Esempio n. 24
0
def initialize(context):
    """ Zope 2
    """
    from Products.EEAEnquiry.tools import catalog

    cmfutils.ToolInit('Enquiry Tool',
                      tools=(catalog.EnquiryCatalog, ),
                      icon='tool.gif').initialize(context)

    from Products.EEAEnquiry import content
    content.register_content()

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = atapi.process_types(
        listTypes(config.PROJECTNAME), config.PROJECTNAME)

    cmfutils.ContentInit(
        config.PROJECTNAME + ' Content',
        content_types=all_content_types,
        permission=config.DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if not klassname in config.ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(
            meta_type=all_ftis[i]['meta_type'],
            constructors=(all_constructors[i], ),
            permission=config.ADD_CONTENT_PERMISSIONS[klassname])
Esempio n. 25
0
def initialize(context):
    validation.register(validators.ProjectIdValidator('isNonConflictingProjectId'))
    validation.register(validators.ProjectContactValidator('isValidContact'))

    # Kick content registration and sys.modules mangling
    from Products.PloneSoftwareCenter import content

    allTypes = listTypes(config.PROJECTNAME)

    # Register Archetypes content with the machinery
    content_types, constructors, ftis = process_types(
        allTypes, config.PROJECTNAME)

    center_content_types = []
    center_constructors  = []

    project_content_types  = []
    project_constructors   = []

    member_content_types  = []
    member_constructors   = []

    for i in range(len(allTypes)):
        aType = allTypes[i]
        if aType['klass'].meta_type in ('PloneSoftwareCenter',):
            center_content_types.append(content_types[i])
            center_constructors.append(constructors[i])
        elif aType['klass'].meta_type in ('PSCProject',):
            project_content_types.append(content_types[i])
            project_constructors.append(constructors[i])
        else:
            member_content_types.append(content_types[i])
            member_constructors.append(constructors[i])

    # software center itself
    ContentInit(
        config.PROJECTNAME + ' Center',
        content_types = tuple(center_content_types),
        permission = psc_permissions.AddSoftwareCenter,
        extra_constructors = tuple(center_constructors),
        fti = ftis,
        ).initialize(context)

    # projects
    ContentInit(
        config.PROJECTNAME + ' Project',
        content_types = tuple(project_content_types),
        permission = psc_permissions.AddProject,
        extra_constructors = tuple(project_constructors),
        fti = ftis,
        ).initialize(context)

    # regular content
    ContentInit(
        config.PROJECTNAME + ' Project Content',
        content_types = tuple(member_content_types),
        permission = permissions.AddPortalContent,
        extra_constructors = tuple(member_constructors),
        fti = ftis,
        ).initialize(context)
def initialize(context):
    """Intializer called when used as a Zope 2 product."""
    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes('archetypes.z3crelationfield'),
        'archetypes.z3crelationfield')

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        cmfutils.ContentInit(
            '%s: %s' % ('archetypes.z3crelationfield', atype.portal_type),
            content_types=(atype, ),
            permission='Add portal content',
            extra_constructors=(constructor, ),
        ).initialize(context)
Esempio n. 27
0
def initialize(context):

    # from Products.validation import validation
    # validation.register(validators.CourseNumberValidator('CourseNumberValidator'))


    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,),
            ).initialize(context)
Esempio n. 28
0
def initialize(context):
    # imports packages and types for registration
    import content
    import interfaces
    import utilities
    import contenthandler

    # Make pyflakes happy
    content
    interfaces
    utilities
    contenthandler

    # Initialize portal content
    content_types, constructors, ftis = process_types(
        listTypes(PROJECTNAME),
        PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types = content_types,
        permission = DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors = constructors,
        fti = ftis,
        ).initialize(context)
def initialize(context):
    """Intializer called when used as a Zope 2 product."""
    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once.

    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes('archetypes.z3crelationfield'),
        'archetypes.z3crelationfield')

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permissions for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        cmfutils.ContentInit('%s: %s' % ('archetypes.z3crelationfield', atype.portal_type),
            content_types      = (atype, ),
            permission         = 'Add portal content',
            extra_constructors = (constructor,),
            ).initialize(context)
Esempio n. 30
0
def initialize(context):
    """ Zope 2
    """
    # Register AT Content-Types
    atapi.registerType(NavigationManager.NavigationManager, PROJECTNAME)
    atapi.registerType(NavigationItem.NavigationItem, PROJECTNAME)

    # Register custom content-types
    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes(PROJECTNAME),
        PROJECTNAME)

    # Initialize portal tools
    cmfutils.ToolInit(
        PROJECTNAME +' Tools',
        tools=(NavigationManager.NavigationManager,),
        icon='tool.gif'
    ).initialize(context)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission="Add portal content",
        extra_constructors=constructors,
        fti=ftis).initialize(context)
def initialize(context):
    # imports packages and types for registration
    from . import content
    from . import interfaces

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes('eXtremeManagement'),
        'eXtremeManagement')

    cmfutils.ContentInit(
        'eXtremeManagement Content',
        content_types=all_content_types,
        permission=config.DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
    ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if not klassname in config.ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(
            meta_type=all_ftis[i]['meta_type'],
            constructors=(all_constructors[i], ),
            permission=config.ADD_CONTENT_PERMISSIONS[klassname])
Esempio n. 32
0
def initialize(context):
    # imports packages and types for registration
    import interfaces
    import psc
    import content

    interfaces, psc, content  # pyflakes

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes(PROJECTNAME),
        PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=all_content_types,
        permission=DEFAULT_ADD_CONTENT_PERMISSION,
        extra_constructors=all_constructors,
        fti=all_ftis,
        ).initialize(context)

    # Give it some extra permissions to control them on a per class limit
    for i in range(0, len(all_content_types)):
        klassname = all_content_types[i].__name__
        if not klassname in ADD_CONTENT_PERMISSIONS:
            continue

        context.registerClass(meta_type=all_ftis[i]['meta_type'],
                              constructors=(all_constructors[i],),
                              permission=ADD_CONTENT_PERMISSIONS[klassname])
Esempio n. 33
0
File: utils.py Progetto: dtgit/dtedu
def gen_class(klass, schema=None):
    """generats and registers the klass
    """
    if schema is not None:
        klass.schema = schema.copy()
    registerType(klass, 'Archetypes')
    content_types, constructors, ftis = process_types(listTypes(), PKG_NAME)
Esempio n. 34
0
def initialize(context):
    ##code-section custom-init-top #fill in your manual code here
    ##/code-section custom-init-top

    # imports packages and types for registration
    import content
    content  # pyflakes

    import WindowZTool

    # Initialize portal tools
    ToolInit(PROJECTNAME +' Tools',
             tools = (WindowZTool.WindowZTool,),
             icon='tool.gif'
             ).initialize(context)

    # Initialize portal content
    all_content_types, all_constructors, all_ftis = process_types(
        listTypes(PROJECTNAME),
        PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types = all_content_types,
        permission = ADD_CONTENT_PERMISSION,
        extra_constructors = all_constructors,
        fti = all_ftis,
        ).initialize(context)
Esempio n. 35
0
def initialize(context):
    from intranett.policy import config
    config.config.register_profile()
    config.config.register_profile(profile_name='content')
    config.config.scan()

    from AccessControl import allow_module
    allow_module('intranett.policy.config')

    from Products.Archetypes import atapi
    from Products.CMFCore import utils

    # Register content
    from intranett.policy.content import membersfolder
    from intranett.policy.content import projectroom
    membersfolder # pyflakes
    projectroom # pyflakes

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

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, ),
            ).initialize(context)
Esempio n. 36
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

    from content.shipment import Shipment
    from content.shipments import Shipments

    from content.kittemplate import KitTemplate
    from content.biospectype import BiospecType
    from content.biospecimen import Biospecimen
    from content.multimage import Multimage
    from content.storagetype import StorageType
    from content.kit import Kit
    from content.kits import Kits
    from content.project import Project
    from content.projects import Projects
    from content.biospecimens import Biospecimens
    from content.inventoryorder import InventoryOrder
    from content.inventoryorderfolder import InventoryOrderFolder
    from content.product import Product
    from content.stockitem import StockItem
    from content.storageunit import StorageUnit
    from content.storageunits import StorageUnits
    from content.managedstorage import ManagedStorage
    from content.unmanagedstorage import UnmanagedStorage
    from content.storageposition import StoragePosition
    from content.donor import SampleDonor
    from content.donors import SampleDonors
    from content.disease_ontology import DiseaseOntology
    from content.disease_ontologies import DiseaseOntologies

    from content.sampleshipment import SampleShipment
    from content.sampleshipments import SampleShipments

    from content.samplebatch import SampleBatch
    from content.samplebatches import SampleBatches

    from controlpanel.bika_kittemplates import KitTemplates
    from controlpanel.bika_biospectypes import BiospecTypes
    from controlpanel.bika_storagetypes import StorageTypes
    from controlpanel.bika_products import Products
    from controlpanel.bika_stockitems import StockItems

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

    # Register each type with it's own Add permission
    # use ADD_CONTENT_PERMISSION as default
    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: Add %s" % (PROJECTNAME, atype.portal_type)
        perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type,
                                           ADD_CONTENT_PERMISSION)
        ContentInit(kind,
                    content_types      = (atype,),
                    permission         = perm,
                    extra_constructors = (constructor,),
                    fti                = ftis,
                    ).initialize(context)
def initialize(context):
    # Kick content registration and sys.modules mangling
    from Products.PloneSoftwareCenter import content
    content  # pyflakes

    allTypes = listTypes(config.PROJECTNAME)

    # Register Archetypes content with the machinery
    content_types, constructors, ftis = process_types(
        allTypes, config.PROJECTNAME)

    center_content_types = []
    center_constructors = []

    project_content_types = []
    project_constructors = []

    member_content_types = []
    member_constructors = []

    for i in range(len(allTypes)):
        aType = allTypes[i]
        if aType['klass'].meta_type in ('PloneSoftwareCenter',):
            center_content_types.append(content_types[i])
            center_constructors.append(constructors[i])
        elif aType['klass'].meta_type in ('PSCProject',):
            project_content_types.append(content_types[i])
            project_constructors.append(constructors[i])
        else:
            member_content_types.append(content_types[i])
            member_constructors.append(constructors[i])

    # software center itself
    ContentInit(
        config.PROJECTNAME + ' Center',
        content_types=tuple(center_content_types),
        permission=psc_permissions.AddSoftwareCenter,
        extra_constructors=tuple(center_constructors),
        fti=ftis,
        ).initialize(context)

    # projects
    ContentInit(
        config.PROJECTNAME + ' Project',
        content_types=tuple(project_content_types),
        permission=psc_permissions.AddProject,
        extra_constructors=tuple(project_constructors),
        fti=ftis,
        ).initialize(context)

    # regular content
    ContentInit(
        config.PROJECTNAME + ' Project Content',
        content_types=tuple(member_content_types),
        permission=cmf_permissions.AddPortalContent,
        extra_constructors=tuple(member_constructors),
        fti=ftis,
        ).initialize(context)
def initialize(context):
    """Initializer called when used as a Zope 2 product.

    This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
    is necessary for GenericSetup profiles to work, for example.

    Here, we call the Archetypes machinery to register our content types
    with Zope and the CMF.

      >>> from collective.realestatebroker import initialize
      >>> class MockContext:
      ...     def registerClass(*args, **kw):
      ...         pass
      >>> context = MockContext()
      >>> initialize(context)
    """

    # Retrieve the content types that have been registered with Archetypes
    # This happens when the content type is imported and the registerType()
    # call in the content type's module is invoked. Actually, this happens
    # during ZCML processing, but we do it here again to be explicit. Of
    # course, even if we import the module several times, it is only run
    # once!

    from content import residential
    from content import commercial
    residential, commercial  # pyflakes


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

    # Now initialize all these content types. The initialization process takes
    # care of registering low-level Zope 2 factories, including the relevant
    # add-permission. These are listed in config.py. We use different
    # permisisons for each content type to allow maximum flexibility of who
    # can add which content types, where. The roles are set up in rolemap.xml
    # in the GenericSetup profile.

    for atype, constructor in zip(content_types, constructors):
        cmfutils.ContentInit(
            "%s: %s" % (config.PROJECTNAME, atype.portal_type),
            content_types = (atype,),
            permission = config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors = (constructor,),
            ).initialize(context)

    # Add an extra scaling size to the ATImage scaling list
    image_sizes = ATImage.schema['image'].sizes
    if not image_sizes.has_key('tile96'):
        image_sizes['tile96'] = (96,96)
        ATImage.schema['image'].sizes = image_sizes


    ATImage.schema['image'].original_size = (768,768)
Esempio n. 39
0
def initialize(context):
    content_types, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME)

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit(
            "%s: %s" % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype,),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,),
        ).initialize(context)
Esempio n. 40
0
def initialize(context):

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

    utils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission=ADD_PERMISSION,
        extra_constructors=constructors,
        fti=ftis,).initialize(context)
Esempio n. 41
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes(config.PROJECTNAME),
        config.PROJECTNAME)
    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype,),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,),
            ).initialize(context)
Esempio n. 42
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    from content import rdffolder, bodysystem, disease, site, publication, protocol, registeredperson, committee
    contentTypes, constructors, ftis = atapi.process_types(
        atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME)
    for atype, constructor in zip(contentTypes, constructors):
        Products.CMFCore.utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, )).initialize(context)
Esempio n. 43
0
def initialize(context):
    import demo

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

    ContentInit(
        PROJECTNAME + " Content",
        content_types=content_types,
        permission=AddPortalContent,
        extra_constructors=constructors,
    ).initialize(context)
Esempio n. 44
0
def initialize(context):
    '''Initializer called when used as a Zope 2 product.'''
    from content import datasetfolder, dataset
    contentTypes, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME)
    for atype, constructor in zip(contentTypes, constructors):
        Products.CMFCore.utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype,),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,)
        ).initialize(context)
Esempio n. 45
0
def initialize(context):
    '''Initializer called when used as a Zope 2 product.'''
    from content import studyfolder, protocol
    contentTypes, constructors, ftis = atapi.process_types(
        atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME)
    for atype, constructor in zip(contentTypes, constructors):
        Products.CMFCore.utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, )).initialize(context)
Esempio n. 46
0
def initialize(context):
    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes(config.PROJECTNAME),
        config.PROJECTNAME)

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,),
            ).initialize(context)
Esempio n. 47
0
def initialize(context):

    from content.aetiologicagent import AetiologicAgent
    from content.caseoutcome import CaseOutcome
    from content.casestatus import CaseStatus
    from content.ethnicity import Ethnicity
    from content.casesyndromicclassification import CaseSyndromicClassification
    from content.disease import Disease
    from content.doctor import Doctor
    from content.doctors import Doctors
    from content.drug import Drug
    from content.drugprohibition import DrugProhibition
    from content.epidemiologicalyear import EpidemiologicalYear
    from content.identifiertype import IdentifierType
    from content.immunization import Immunization
    from content.insurancecompany import InsuranceCompany
    from content.patient import Patient
    from content.patients import Patients
    from content.symptom import Symptom
    from content.treatment import Treatment
    from content.vaccinationcenter import VaccinationCenter
    from content.vaccinationcentercontact import VaccinationCenterContact

    from controlpanel.bika_aetiologicagents import AetiologicAgents
    from controlpanel.bika_caseoutcomes import CaseOutcomes
    from controlpanel.bika_casesyndromicclassifications import CaseSyndromicClassifications
    from controlpanel.bika_casestatuses import CaseStatuses
    from controlpanel.bika_diseases import Diseases
    from controlpanel.bika_drugprohibitions import DrugProhibitions
    from controlpanel.bika_drugs import Drugs
    from controlpanel.bika_epidemiologicalyears import EpidemiologicalYears
    from controlpanel.bika_identifiertypes import IdentifierTypes
    from controlpanel.bika_immunizations import Immunizations
    from controlpanel.bika_treatments import Treatments
    from controlpanel.bika_insurancecompanies import InsuranceCompanies
    from controlpanel.bika_ethnicities import Ethnicities
    from controlpanel.bika_vaccinationcenters import VaccinationCenters

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

    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type)
        perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type,
                                           ADD_CONTENT_PERMISSION)
        utils.ContentInit(
            kind,
            content_types=(atype, ),
            permission=perm,
            extra_constructors=(constructor, ),
            fti=ftis,
        ).initialize(context)
Esempio n. 48
0
    def afterSetUp(self):
        ATSiteTestCase.afterSetUp(self)
        registerType(Dummy, 'Archetypes')
        content_types, constructors, ftis = process_types(listTypes(), PKG_NAME)
        portal = self.portal
        dummy = Dummy(oid='dummy')
        # put dummy in context of portal
        dummy = dummy.__of__(portal)
        portal.dummy = dummy

        dummy.initializeArchetype()
        self._dummy = dummy
Esempio n. 49
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

    content_types, constructors, ftis = atapi.process_types(atapi.listTypes('uwosh.admissionsPDFs'), 'uwosh.admissionsPDFs')

    cmfutils.ContentInit(
        'uwosh.admissionsPDFs Content',
        content_types = content_types,
        permission = ADD_CONTENT_PERMISSION,
        extra_constructors = constructors,
        fti = ftis,
        ).initialize(context)
def initialize(context):
    import demo
    demo  # pyflakes
    content_types, constructors, ftis = process_types(listTypes(PROJECTNAME),
                                                      PROJECTNAME)

    ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission=AddPortalContent,
        extra_constructors=constructors,
    ).initialize(context)
Esempio n. 51
0
def initialize(context):
    # Example content type initialization
    import Products.DataGridField.examples
    content_types, constructors, ftis = process_types(listTypes(PKG_NAME), PKG_NAME,)

    ContentInit(
        '%s Content' % PKG_NAME,
        content_types = content_types,
        permission = AddPortalContent,
        extra_constructors = constructors,
        fti = ftis,
        ).initialize(context)
Esempio n. 52
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    # Fill in modules that provide content implementations:
    from content import fundingfolder, fundingopportunity, announcement
    contentTypes, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME)
    for atype, constructor in zip(contentTypes, constructors):
        Products.CMFCore.utils.ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype,),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor,)
        ).initialize(context)
def initialize(context):
    # Example content type initialization
    import Products.DataGridField.examples
    content_types, constructors, ftis = process_types(
        listTypes(PKG_NAME), PKG_NAME, )

    ContentInit(
        '%s Content' % PKG_NAME,
        content_types=content_types,
        permission=AddPortalContent,
        extra_constructors=constructors,
        fti=ftis,
        ).initialize(context)
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

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

    for atype, constructor in zip(content_types, constructors):
        utils.ContentInit(
            '{}: {}'.format(PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, ),
        ).initialize(context)
Esempio n. 55
0
def initialize(context):
    """Inicializador chamado quando usado como um produto Zope 2."""

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

    for atype, constructor in zip(content_types, constructors):
        ContentInit(
            '%s: %s' % (config.PROJECTNAME, atype.portal_type),
            content_types=(atype, ),
            permission=config.ADD_PERMISSIONS[atype.portal_type],
            extra_constructors=(constructor, ),
        ).initialize(context)
Esempio n. 56
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

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

    utils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission=ADD_PERMISSION,
        extra_constructors=constructors,
        fti=ftis,
        ).initialize(context)
Esempio n. 57
0
def initialize(context):
    """ Zope2 init
    """
    content_types, constructors, ftis = process_types(listTypes(PROJECTNAME),
                                                      PROJECTNAME)

    cmfutils.ContentInit(
        PROJECTNAME + ' Content',
        content_types=content_types,
        permission=ADD_CONTENT_PERMISSION,
        extra_constructors=constructors,
        fti=ftis,
    ).initialize(context)
Esempio n. 58
0
def initialize(context):
    """ Initialize product (called by zope2)
    """
    content.register()

    # Initialize portal content
    content_types, constructors, ftis = atapi.process_types(
        atapi.listTypes(PACKAGE_NAME), PACKAGE_NAME)

    utils.ContentInit(PACKAGE_NAME,
                      content_types=content_types,
                      permission=ADD_PERMISSION,
                      extra_constructors=constructors,
                      fti=ftis).initialize(context)