[Zope-CMF] [RFC] Type mess and allowed_content_types

Florent Guillaume fg@nuxeo.com
Fri, 5 Jul 2002 19:59:43 +0000 (UTC)


Okay, I'm done with that. I also fixed listFolderContent's filtering.

It's a fairly pervasive change so I'd appreciate if a few people could
check that everything still works ok with them (especially those who
needed correct filtering), and that I didn't make any dumb mistake.

Note (see INSTALL.txt) that there is a new index, "portal_type", that
you'll have to create by hand if you want to find your News Items.

I'll copy the CVS checkin message here too:

----------------------------------------------------------------------
Fixed the Types Tool so that TypeInformation's Title is decorrelated
from its Id (the old TypeInformation.Type() should not be used anymore).

The Id is what gets put in the "portal_type" attribute of a content
object, which one gets at using somecontent.getPortalTypeName(). The
Title is returned by somecontent.Type().

"portal_type" is now indexed, and in most cases should be used when
doing catalog queries instead of "Type". Note that when upgrading from
older versions this index will have to be added by hand (see
INSTALL.txt).

Fixed PortalFolder's filtering so that it correctly restricts itself to
the portal types allowed by the TypesTool (Tracker #483).
----------------------------------------------------------------------

Florent


Florent Guillaume  <fg@nuxeo.com> wrote:
> I'd like to clean up the Type mess now. That means, use ti.getId() or
> portal_type everywhere program logic is involved.
> 
> The only real impact I see is that allowed_content_types in the
> TypeInformation (TI) objects currently contain a ti.Type() where we want
> it to contain ti.getId().
> 
> There will be a problem when upgrading for those who have non-empty
> title. When upgrading, those types won't be preselected in the "Allowed
> content types" property of the TI of their container types.
> 
> But because this non-empty title poses problems anyway for filtering
> (currently it's broken), those that have any probably also have
> filtering disabled, so I think it's ok.
> 
> So a portal_type index would be used to find stuff, and the various
> scripts (recent_news, news_box) would use it. Type would be deprecated
> for all program logic. TI.Type would become TI.Title. DublinCore's Type
> would call TI.Title.
> 
> Anyone has a problem with this change, or comments ?
> 
> Florent

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