Annotation of kupuMPIWG/plone/kupu_plone_layer/kupuGetResourceTypes.py, revision 1.1.1.1

1.1       dwinter     1: ## Script (Python) "kupuGetResourceTypes"
                      2: ##title=Provide a list of portal types for a resource
                      3: ##bind container=container
                      4: ##bind context=context
                      5: ##bind namespace=
                      6: ##bind script=script
                      7: ##bind subpath=traverse_subpath
                      8: ##parameters=resource_type, includeCollections=False
                      9: from Products.CMFCore.utils import getToolByName
                     10: kupu_tool = getToolByName(context, 'kupu_library_tool')
                     11: types_tool = getToolByName(context, 'portal_types')
                     12: 
                     13: portal_types = kupu_tool.queryPortalTypesForResourceType(resource_type, ())
                     14: 
                     15: if includeCollections:
                     16:     coll_types = kupu_tool.queryPortalTypesForResourceType('collection', ())
                     17:     portal_types += coll_types
                     18: 
                     19: return { 'portal_type': portal_types }
                     20: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>