[CPS-devel] getCreatableItems returns all creatable Items in portal_root

Joachim Schmitz js at aixtraware.de
Thu Jul 6 19:58:06 CEST 2006


Hi,

for our project, we defined a new theme, which is also visible in the 
portal_root, more for testing purposes, we used there  an add_item 
portlet. This works as exspected as long as one is not in the root of 
the portal. I could correct this by the following patch in 
getCreatableItems.py

How can I test if I am at the portal_root more reliably ?

## Script (Python) "getCreatableItems"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
items = []
utool = context.portal_url
base_url = utool.getBaseUrl()
### patch starts
if context.absolute_url().endswith(base_url[:-1]):
     return []
###

content_types = context.getSortedContentTypes(allowed=1)
renderIcon = context.portal_cpsportlets.renderIcon

for ptype in content_types:
     ptype_id = ptype.getId()
     items.append({
         'title': ptype.Title(),
         'id': ptype_id,
         'icon_tag': renderIcon(ptype_id, base_url, '')
     })

return items


-- 
Mit freundlichen Grüßen                                Joachim Schmitz
......................................................................
AixtraWare eK ..Joachim Schmitz ..www.aixtraware.de ..t: +49-2464-8851
Hüsgenstr. 33a .....d-52457 Aldenhoven .............f: +49-2464-905163




More information about the cps-devel mailing list

This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.