Esempio n. 1
0
def initialize(context):
    # register the CMFMember migrators, if necessary
    if config.CMFMEMBER_MIGRATION_SUPPORT:
        registerMigrators()

    # Register a PAS plugin
    pas_install.register_pas_plugin_class(context)
    # Some methods are needed in restricted python:
    allow_module('Products.remember.pas.utils')

    # Importing the content types allows for their registration
    # with the Archetypes runtime
    import content
    content  # pyflakes

    # Ask Archetypes to handback all the type information needed
    # to make the CMF happy.
    types = atapi.listTypes(config.PROJECT_NAME)
    content_types, constructors, ftis = \
        atapi.process_types(types, config.PROJECT_NAME)

    # We register each type with an add permission that is set
    # in permissions.py.  By default, each content type has its
    # own permission, but this behavior can be easily overridden.
    permissions = initialize_permissions()
    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: %s" % (config.PROJECT_NAME, atype.archetype_name)
        cmf_utils.ContentInit(
            kind,
            content_types=(atype, ),
            permission=permissions[atype.portal_type],
            extra_constructors=(constructor, ),
            fti=ftis,
        ).initialize(context)

    profile_registry.registerProfile('uninstall',
                                     'uninstall remember',
                                     'Uninstall remember.',
                                     'profiles/uninstall',
                                     'remember',
                                     EXTENSION,
                                     for_=ISiteRoot,
                                     )

    # register image property type for user property sheets
    PropertySchema.addType('image',
                           lambda x: x is None or isinstance(x, Image))
Esempio n. 2
0
def initialize(context):
    # register the CMFMember migrators, if necessary
    if config.CMFMEMBER_MIGRATION_SUPPORT:
        registerMigrators()
    
    # Importing the content types allows for their registration
    # with the Archetypes runtime
    import content

    # Ask Archetypes to handback all the type information needed
    # to make the CMF happy.
    types = atapi.listTypes(config.PROJECT_NAME)
    content_types, constructors, ftis = \
        atapi.process_types(types, config.PROJECT_NAME)

    # We register each type with an add permission that is set
    # in permissions.py.  By default, each content type has its
    # own permission, but this behavior can be easily overridden.
    permissions = initialize_permissions()
    allTypes = zip(content_types, constructors)
    for atype, constructor in allTypes:
        kind = "%s: %s" % (config.PROJECT_NAME, atype.archetype_name)
        cmf_utils.ContentInit(
            kind,
            content_types      = (atype,),
            permission         = permissions[atype.portal_type],
            extra_constructors = (constructor,),
            fti                = ftis,
            ).initialize(context)


    profile_desc = "Installs membrane-based Plone member implementation."
    profile_registry.registerProfile('default',
                                     'remember',
                                     profile_desc,
                                     'profiles/default',
                                     'remember',
                                     EXTENSION,
                                     for_=IPloneSiteRoot,
                                     )

    # register image property type for user property sheets
    PropertySchema.addType('image',
                           lambda x: x is None or isinstance(x, Image))