[Zope-CMF] manage_predicates form bug when a factory-based type information has a title that differs from its id.

Patrick Decat pdecat@lfvie.generali.fr
Thu, 18 Oct 2001 14:33:38 +0200


Hi all,

I'm quite new to Zope and CMF so I may be wrong, but I think I've =
encountered a bug
in the manage_predicates form of the ContentTypeRegistry:

If a factory-based type information is defined in the portal_types =
having a title that differs
from its id, the manage_predicates form will use the title property =
instead of the id to define
predicates.

For example, I have the following factory-based type information in my =
portal_types' folder
associated to the 'file' predicate (matching all files with an =
extension) :
id =3D 'CMFExternalFile'
title =3D 'Fichier'

What's wrong is that when a PortalFolder's PUT_factory method is called, =
it then calls
        typeObjectName =3D registry.findTypeName( name, typ, body )
which returns the string 'Fichier' instead of 'CMFExternalFile'.

Thus, the next call fails as I have no factory-based type information =
with the id 'Fichier' in
my portal_types:
        self.invokeFactory( typeObjectName, name )

Here is the patch I've applied to the manage_predicates form to correct =
this bug.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs-repository/CMF/CMFCore/dtml/registryPredList.dtml,v
retrieving revision 1.2
diff -r1.2 registryPredList.dtml
26,28c26,29
<       <dtml-in listContentTypes>
<         <dtml-let item=3Dsequence-item
<                   sel=3D"item =3D=3D typName and 'selected' or ''"
---
>       <dtml-in objectItems prefix=3D"type">
>         <dtml-let typeName=3D"type_item.title"
>                   typeId=3Dtype_key
>                   sel=3D"typeId =3D=3D typName and 'selected' or ''"
30c31
<          <option &dtml-sel;> &dtml-sequence-item; </option>
---
>          <option &dtml-sel; value=3D"&dtml-typeId;"> &dtml-typeName; =
</option>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Regards,
Patrick.