Nuxeo mailing list archives
[CPS-devel] getCreatableItems returns all creatable Items in
portal_root
Florent Guillaume
fg at nuxeo.com
Fri Jul 7 09:39:55 CEST 2006
Check context.getPortalTypeName() != 'Portal'.
Florent
Florent
On 6 Jul 2006, at 19:58, Joachim Schmitz wrote:
> 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
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
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.