From: dpunktnpunkt <svn...@pl...> - 2005-06-23 12:14:26
|
Author: dpunktnpunkt Date: Thu Jun 23 08:06:20 2005 New Revision: 4496 Modified: Archetypes/branches/release-1_3-branch/ArchetypeTool.py Archetypes/branches/release-1_3-branch/tests/test_doctests.py Log: Added doctest to ArchetypeTool.listPortalTypesWithInterfaces Modified: Archetypes/branches/release-1_3-branch/ArchetypeTool.py ============================================================================== --- Archetypes/branches/release-1_3-branch/ArchetypeTool.py (original) +++ Archetypes/branches/release-1_3-branch/ArchetypeTool.py Thu Jun 23 08:06:20 2005 @@ -681,8 +681,19 @@ security.declareProtected(CMFCorePermissions.View, 'listPortalTypesWithInterfaces') def listPortalTypesWithInterfaces(self, ifaces): - """Returns a list of portal_types implementing one of the given - interfaces + """Returns a list of ftis of which the types implement one of + the given interfaces. + + Get a list of FTIs of types implementing IReferenceable: + >>> tool = getToolByName(self.portal, TOOL_NAME) + >>> meth = tool.listPortalTypesWithInterfaces + >>> ftis = tool.listPortalTypesWithInterfaces([IReferenceable]) + + Sort the type ids and print them: + >>> type_ids = [fti.getId() for fti in ftis] + >>> type_ids.sort() + >>> type_ids + ['ComplexType', 'Document', ...] """ tt = getToolByName(self, 'portal_types') if tt is None: Modified: Archetypes/branches/release-1_3-branch/tests/test_doctests.py ============================================================================== --- Archetypes/branches/release-1_3-branch/tests/test_doctests.py (original) +++ Archetypes/branches/release-1_3-branch/tests/test_doctests.py Thu Jun 23 08:06:20 2005 @@ -41,6 +41,7 @@ DOCTEST_MODULES = ( 'Products.Archetypes.utils', 'Products.Archetypes.Schema', + 'Products.Archetypes.ArchetypeTool' ) DOCTEST_FILES = () |