def test_getImportContextID( self ): from Products.CMFSetup.tool import IMPORT_STEPS_XML from Products.CMFSetup.tool import EXPORT_STEPS_XML from Products.CMFSetup.tool import TOOLSET_XML from test_registry import _EMPTY_IMPORT_XML from test_registry import _EMPTY_EXPORT_XML from test_registry import _EMPTY_TOOLSET_XML from common import _makeTestFile tool = self._makeOne() _makeTestFile( IMPORT_STEPS_XML , self._PROFILE_PATH , _EMPTY_IMPORT_XML ) _makeTestFile( EXPORT_STEPS_XML , self._PROFILE_PATH , _EMPTY_EXPORT_XML ) _makeTestFile( TOOLSET_XML , self._PROFILE_PATH , _EMPTY_TOOLSET_XML ) profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH) tool.setImportContext('profile-other:foo') self.assertEqual( tool.getImportContextID(), 'profile-other:foo' )
def test_setImportContext(self): from Products.CMFSetup.tool import IMPORT_STEPS_XML from Products.CMFSetup.tool import EXPORT_STEPS_XML from Products.CMFSetup.tool import TOOLSET_XML from test_registry import _SINGLE_IMPORT_XML from test_registry import _SINGLE_EXPORT_XML from test_registry import _NORMAL_TOOLSET_XML from test_registry import ONE_FUNC from common import _makeTestFile tool = self._makeOne() tool.getExportStepRegistry().clear() _makeTestFile(IMPORT_STEPS_XML, self._PROFILE_PATH, _SINGLE_IMPORT_XML) _makeTestFile(EXPORT_STEPS_XML, self._PROFILE_PATH, _SINGLE_EXPORT_XML) _makeTestFile(TOOLSET_XML, self._PROFILE_PATH, _NORMAL_TOOLSET_XML) profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH) tool.setImportContext('profile-other:foo') self.assertEqual(tool.getImportContextID(), 'profile-other:foo') import_registry = tool.getImportStepRegistry() self.assertEqual(len(import_registry.listSteps()), 1) self.failUnless('one' in import_registry.listSteps()) info = import_registry.getStepMetadata('one') self.assertEqual(info['id'], 'one') self.assertEqual(info['title'], 'One Step') self.assertEqual(info['version'], '1') self.failUnless('One small step' in info['description']) self.assertEqual(info['handler'], 'Products.CMFSetup.tests.test_registry.ONE_FUNC') self.assertEqual(import_registry.getStep('one'), ONE_FUNC) export_registry = tool.getExportStepRegistry() self.assertEqual(len(export_registry.listSteps()), 1) self.failUnless('one' in import_registry.listSteps()) info = export_registry.getStepMetadata('one') self.assertEqual(info['id'], 'one') self.assertEqual(info['title'], 'One Step') self.failUnless('One small step' in info['description']) self.assertEqual(info['handler'], 'Products.CMFSetup.tests.test_registry.ONE_FUNC') self.assertEqual(export_registry.getStep('one'), ONE_FUNC) toolset = tool.getToolsetRegistry() self.assertEqual(len(toolset.listForbiddenTools()), 1) self.failUnless('doomed' in toolset.listForbiddenTools()) self.assertEqual(len(toolset.listRequiredTools()), 2) self.failUnless('mandatory' in toolset.listRequiredTools()) info = toolset.getRequiredToolInfo('mandatory') self.assertEqual(info['class'], 'path.to.one') self.failUnless('obligatory' in toolset.listRequiredTools()) info = toolset.getRequiredToolInfo('obligatory') self.assertEqual(info['class'], 'path.to.another')
def initialize(context): context.registerClass( LDAPUserFolder , permission=add_user_folders , constructors=(manage_addLDAPUserFolder,) , icon='www/ldapuserfolder.gif' ) context.registerClass( LDAPUserSatellite , permission=add_user_folders , constructors=( addLDAPUserSatelliteForm , manage_addLDAPUserSatellite ) , icon='www/ldapusersatellite.gif' ) context.registerHelp() if have_cmf is True: profile_registry.registerProfile( 'default' , 'LDAPUserFolder CMF Tools' , 'Adds LDAP support to the CMF.' , 'profiles/default' , 'LDAPUserFolder' , EXTENSION )
def initialize( context ): from Products.CMFCore.DirectoryView import registerDirectory from Products.CMFCore.utils import ToolInit try: from Products.CMFSetup import EXTENSION from Products.CMFSetup import profile_registry has_profile_registry = True except ImportError: has_profile_registry = False import ActionIconsTool ToolInit( meta_type='CMF Action Icons Tool' , tools=( ActionIconsTool.ActionIconsTool, ) , icon="tool.gif" ).initialize( context ) registerDirectory('skins', cmfactionicons_globals) if has_profile_registry: profile_registry.registerProfile('actionicons', 'CMFActionIcons', 'Adds action icon tool / settings.', 'profiles/actionicons', 'CMFActionIcons', EXTENSION)
def initialize(context): ToolInit(meta_type='CMF Action Icons Tool', tools=(ActionIconsTool.ActionIconsTool, ), icon="tool.gif").initialize(context) if has_profile_registry: profile_registry.registerProfile('actionicons', 'CMFActionIcons', 'Adds action icon tool / settings.', 'profiles/actionicons', 'CMFActionIcons', EXTENSION)
def initialize(context): utils.initializeBasesPhase2(z_tool_bases, context) utils.ToolInit('CMF Unique Id Tool', tools=tools, icon='tool.gif').initialize(context) if has_profile_registry: profile_registry.registerProfile('default', 'CMFUid', 'Adds UID support.', 'profiles/default', 'CMFUid', EXTENSION)
def initialize( context ): ToolInit( meta_type='CMF Action Icons Tool' , tools=( ActionIconsTool.ActionIconsTool, ) , icon="tool.gif" ).initialize( context ) if has_profile_registry: profile_registry.registerProfile('actionicons', 'CMFActionIcons', 'Adds action icon tool / settings.', 'profiles/actionicons', 'CMFActionIcons', EXTENSION)
def initialize( context ): initializeBasesPhase2( z_bases, context ) initializeBasesPhase2( z_tool_bases, context ) ToolInit( 'CMF Default Tool' , tools=tools , product_name='CMFDefault' , icon='tool.gif' ).initialize( context ) ContentInit( 'CMF Default Content' , content_types=contentClasses , permission=AddPortalContent , extra_constructors=contentConstructors , fti=Portal.factory_type_information ).initialize( context ) if has_profile_registry: profile_registry.registerProfile('default', 'CMFDefault Site', 'Profile for a default CMFSite.', 'profiles/default', 'CMFDefault', BASE) context.registerClass( Portal.CMFSite , constructors=( Portal.manage_addCMFSiteForm , Portal.manage_addCMFSite ) , icon='portal.gif' ) registerIcon( DefaultWorkflow.DefaultWorkflowDefinition , 'images/workflow.gif' , globals() ) # make registerHelp work with 2 directories help = context.getProductHelp() lastRegistered = help.lastRegistered context.registerHelp(directory='help', clear=1) context.registerHelp(directory='interfaces', clear=1) if help.lastRegistered != lastRegistered: help.lastRegistered = None context.registerHelp(directory='help', clear=1) help.lastRegistered = None context.registerHelp(directory='interfaces', clear=0) context.registerHelpTitle('CMF Default Help')
def initialize( context ): initializeBasesPhase2( z_bases, context ) initializeBasesPhase2( z_tool_bases, context ) ToolInit( 'CMF Default Tool' , tools=tools , icon='tool.gif' ).initialize( context ) ContentInit( 'CMF Default Content' , content_types=contentClasses , permission=AddPortalContent , extra_constructors=contentConstructors , fti=Portal.factory_type_information ).initialize( context ) if has_profile_registry: profile_registry.registerProfile('default', 'CMFDefault Site', 'Profile for a default CMFSite.', 'profiles/default', 'CMFDefault', BASE) context.registerClass( Portal.CMFSite , constructors=( Portal.manage_addCMFSiteForm , Portal.manage_addCMFSite ) , icon='portal.gif' ) registerIcon( DefaultWorkflow.DefaultWorkflowDefinition , 'images/workflow.gif' , globals() ) # make registerHelp work with 2 directories help = context.getProductHelp() lastRegistered = help.lastRegistered context.registerHelp(directory='help', clear=1) context.registerHelp(directory='interfaces', clear=1) if help.lastRegistered != lastRegistered: help.lastRegistered = None context.registerHelp(directory='help', clear=1) help.lastRegistered = None context.registerHelp(directory='interfaces', clear=0) context.registerHelpTitle('CMF Default Help')
def initialize(context): utils.initializeBasesPhase2(z_tool_bases, context) utils.ToolInit( 'CMF Unique Id Tool' , tools=tools , icon='tool.gif' ).initialize(context) if has_profile_registry: profile_registry.registerProfile('default', 'CMFUid', 'Adds UID support.', 'profiles/default', 'CMFUid', EXTENSION)
def initialize( context ): utils.ToolInit('CMF Calendar Tool', tools=tools, icon='tool.gif', ).initialize( context ) utils.initializeBasesPhase2( z_bases, context ) utils.ContentInit( 'CMF Event' , content_types = contentClasses , permission = AddPortalContent , extra_constructors = contentConstructors , fti = Event.factory_type_information ).initialize( context ) if has_profile_registry: profile_registry.registerProfile('default', 'CMFCalendar', 'Adds calendar support.', 'profiles/default', 'CMFCalendar', EXTENSION)
def initialize(context): from Products.CMFCore.DirectoryView import registerDirectory from Products.CMFCore.utils import ToolInit try: from Products.CMFSetup import EXTENSION from Products.CMFSetup import profile_registry has_profile_registry = True except ImportError: has_profile_registry = False import ActionIconsTool ToolInit(meta_type='CMF Action Icons Tool', tools=(ActionIconsTool.ActionIconsTool, ), icon="tool.gif").initialize(context) registerDirectory('skins', cmfactionicons_globals) if has_profile_registry: profile_registry.registerProfile('actionicons', 'CMFActionIcons', 'Adds action icon tool / settings.', 'profiles/actionicons', 'CMFActionIcons', EXTENSION)
def test_setImportContext( self ): from Products.CMFSetup.tool import IMPORT_STEPS_XML from Products.CMFSetup.tool import EXPORT_STEPS_XML from Products.CMFSetup.tool import TOOLSET_XML from test_registry import _SINGLE_IMPORT_XML from test_registry import _SINGLE_EXPORT_XML from test_registry import _NORMAL_TOOLSET_XML from test_registry import ONE_FUNC from common import _makeTestFile tool = self._makeOne() tool.getExportStepRegistry().clear() _makeTestFile( IMPORT_STEPS_XML , self._PROFILE_PATH , _SINGLE_IMPORT_XML ) _makeTestFile( EXPORT_STEPS_XML , self._PROFILE_PATH , _SINGLE_EXPORT_XML ) _makeTestFile( TOOLSET_XML , self._PROFILE_PATH , _NORMAL_TOOLSET_XML ) profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH) tool.setImportContext('profile-other:foo') self.assertEqual( tool.getImportContextID(), 'profile-other:foo' ) import_registry = tool.getImportStepRegistry() self.assertEqual( len( import_registry.listSteps() ), 1 ) self.failUnless( 'one' in import_registry.listSteps() ) info = import_registry.getStepMetadata( 'one' ) self.assertEqual( info[ 'id' ], 'one' ) self.assertEqual( info[ 'title' ], 'One Step' ) self.assertEqual( info[ 'version' ], '1' ) self.failUnless( 'One small step' in info[ 'description' ] ) self.assertEqual( info[ 'handler' ] , 'Products.CMFSetup.tests.test_registry.ONE_FUNC' ) self.assertEqual( import_registry.getStep( 'one' ), ONE_FUNC ) export_registry = tool.getExportStepRegistry() self.assertEqual( len( export_registry.listSteps() ), 1 ) self.failUnless( 'one' in import_registry.listSteps() ) info = export_registry.getStepMetadata( 'one' ) self.assertEqual( info[ 'id' ], 'one' ) self.assertEqual( info[ 'title' ], 'One Step' ) self.failUnless( 'One small step' in info[ 'description' ] ) self.assertEqual( info[ 'handler' ] , 'Products.CMFSetup.tests.test_registry.ONE_FUNC' ) self.assertEqual( export_registry.getStep( 'one' ), ONE_FUNC ) toolset = tool.getToolsetRegistry() self.assertEqual( len( toolset.listForbiddenTools() ), 1 ) self.failUnless( 'doomed' in toolset.listForbiddenTools() ) self.assertEqual( len( toolset.listRequiredTools() ), 2 ) self.failUnless( 'mandatory' in toolset.listRequiredTools() ) info = toolset.getRequiredToolInfo( 'mandatory' ) self.assertEqual( info[ 'class' ], 'path.to.one' ) self.failUnless( 'obligatory' in toolset.listRequiredTools() ) info = toolset.getRequiredToolInfo( 'obligatory' ) self.assertEqual( info[ 'class' ], 'path.to.another' )