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


_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to