[Zope-CMF] allowedContentTypes

Kevin Carlson khcarlso@bellsouth.net
Sat, 14 Sep 2002 16:34:29 -0400


Thanks, Florent.  What I ended up iterating over to solve this problem was
the following:

   portal_types.getTypeInfo('Folder').allowed_content_types

Kevin

-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of Florent Guillaume
Sent: Friday, September 13, 2002 6:45 PM
To: zope-cmf@zope.org
Subject: Re: [Zope-CMF] allowedContentTypes


Kevin Carlson <khcarlso@bellsouth.net> wrote:
> I am using the allowedContentTypes method to retrieve the, you guessed it,
> allowed content types for a folder.  The problem I am having is that when
an
> anonymous user calls this function, it returns nothing.  I have checked
the
> portal_types tool and all is set up correctly (filter types on, numerous
> types selected).
>
> The reason that an anonymous user needs to call this is so that I can
allow
> search results to be narrowed by document type.  I am doing the following:
>
> <dtml-in allowedContentTypes>
> ...
> </dtml-in>
>
> This returns nothing.  I have tried giving the dtml method a proxy role of
> Manager but that does not work.  When I try to set the proxy role to
Member,
> I get the following error message:
>
>    You are not authorized to change [method] because you do not have proxy
> roles.
>
> I haven't seen that before.  Is my first problem related to the second? If
> not, can anyone offer an explanation / solution to either problem?

allowedContentTypes is a method of the current folder, which checks
which types are allowed for construction, for the current user, in the
given folder. As the docstring of allowedContentTypes says, """List type
info objects for types which can be added in this folder."""

If what you want is to list all the content types viewable by the
current user in the portal, use portal_types.listTypeInfo().

If you want a different definition for "allowed document types in this
context" then that's a restriction imposed by your application, and
you'll have to provide your own methods to do the filtering.

Florent

--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests