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 ) setup_tool = SetupTool() site._setObject( 'portal_setup', setup_tool ) setup_tool = getToolByName( site, 'portal_setup' ) 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() )
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 = getToolByName(site, _TOOL_ID) setup_tool.setBaselineContext('profile-%s' % profile_id) setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id) for extension_id in extension_ids: setup_tool.runAllImportStepsFromProfile('profile-%s' % extension_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))
def restorePloneTool(context): portal = getToolByName(context, 'portal_url').getPortalObject() tool = getToolByName(portal, "plone_utils") if tool.meta_type == 'PlonePAS Utilities Tool': from Products.CMFPlone.PloneTool import PloneTool from Products.CMFDefault.Portal import CMFSite # PloneSite has its own security check for manage_delObjects which # breaks in the test runner. So we bypass this check. CMFSite.manage_delObjects(portal, ['plone_utils']) portal._setObject(PloneTool.id, PloneTool()) logger.info("Replaced obsolete PlonePAS version of plone tool " "with the normal one.")
def manage_delObjects(self, ids=[], REQUEST=None): """We need to enforce security.""" if isinstance(ids, basestring): ids = [ids] for id in ids: item = self._getOb(id) if not _checkPermission(permissions.DeleteObjects, item): raise Unauthorized, ("Do not have permissions to remove this object") return CMFSite.manage_delObjects(self, ids, REQUEST=REQUEST)
def addConfiguredSite( dispatcher, site_id, profile_id, RESPONSE=None ): """ Add a CMFSite to 'dispatcher', configured according to 'profile_id'. """ site = CMFSite( site_id ) dispatcher._setObject( site_id, site ) site = dispatcher._getOb( site_id ) setup_tool = SetupTool() site._setObject( 'portal_setup', setup_tool ) setup_tool = getToolByName( site, 'portal_setup' ) setup_tool.setImportContext( 'profile-%s' % profile_id ) setup_tool.runAllImportSteps() setup_tool.createSnapshot( 'initial_configuration' ) if RESPONSE is not None: RESPONSE.redirect( '%s/manage_main?update_menu=1' % dispatcher.absolute_url() )
def manage_delObjects(self, ids=None, REQUEST=None): """We need to enforce security.""" if ids is None: ids = [] if isinstance(ids, basestring): ids = [ids] for id in ids: item = self._getOb(id) if not _checkPermission(permissions.DeleteObjects, item): raise Unauthorized( "Do not have permissions to remove this object") return CMFSite.manage_delObjects(self, ids, REQUEST=REQUEST)
def addConfiguredSite( dispatcher, site_id, profile_id, RESPONSE=None ): """ Add a CMFSite to 'dispatcher', configured according to 'profile_id'. """ site = CMFSite( site_id ) dispatcher._setObject( site_id, site ) site = dispatcher._getOb( site_id ) setup_tool = SetupTool() site._setObject( 'portal_setup', setup_tool ) setup_tool = getToolByName( site, 'portal_setup' ) profile_info = profile_registry.getProfileInfo( profile_id ) setup_tool.setProfileDirectory( profile_info[ 'path' ] , profile_info.get( 'product' ) ) setup_tool.runAllImportSteps() setup_tool.createSnapshot( 'initial_configuration' ) if RESPONSE is not None: RESPONSE.redirect( '%s/manage_main?update_menu=1' % dispatcher.absolute_url() )
def __init__(self, id, title=''): CMFSite.__init__(self, id, title)
def __init__( self, id, title='' ): CMFSite.__init__( self, id, title )