Beispiel #1
0
def addConfiguredSite(dispatcher,
                      site_id,
                      profile_id,
                      snapshot=True,
                      RESPONSE=None,
                      extension_ids=()):
    """ Add a CMFSite to 'dispatcher', configured according to 'profile_id'.
    """
    site = CMFSite(site_id)
    dispatcher._setObject(site_id, site)
    site = dispatcher._getOb(site_id)

    site._setObject(_TOOL_ID, SetupTool(_TOOL_ID))
    setup_tool = getToolByName(site, _TOOL_ID)

    setup_tool.setImportContext('profile-%s' % profile_id)
    setup_tool.runAllImportSteps()
    for extension_id in extension_ids:
        setup_tool.setImportContext('profile-%s' % extension_id)
        setup_tool.runAllImportSteps()
    setup_tool.setImportContext('profile-%s' % profile_id)

    if snapshot is True:
        setup_tool.createSnapshot('initial_configuration')

    if RESPONSE is not None:
        RESPONSE.redirect('%s/manage_main?update_menu=1' %
                          dispatcher.absolute_url())
Beispiel #2
0
def addConfiguredSite(dispatcher, site_id, profile_id, snapshot=True,
                      RESPONSE=None, extension_ids=()):
    """ Add a CMFSite to 'dispatcher', configured according to 'profile_id'.
    """
    site = CMFSite( site_id )
    dispatcher._setObject( site_id, site )
    site = dispatcher._getOb( site_id )
    setSite(site)

    site._setObject(_TOOL_ID, SetupTool(_TOOL_ID))
    setup_tool = getattr(site, _TOOL_ID)

    setup_tool.setImportContext( 'profile-%s' % profile_id )
    setup_tool.runAllImportSteps()
    for extension_id in extension_ids:
        setup_tool.setImportContext( 'profile-%s' % extension_id )
        setup_tool.runAllImportSteps()
    setup_tool.setImportContext( 'profile-%s' % profile_id )

    if snapshot is True:
        setup_tool.createSnapshot( 'initial_configuration' )

    if RESPONSE is not None:
        RESPONSE.redirect( '%s/%s/manage_main?update_menu=1'
                         % (dispatcher.absolute_url(), site_id) )