[Zope-dev] getPropertyType returns None in ZClass
Alexandre Ratti
alex@gabuzomeu.net
Mon, 22 Nov 1999 18:28:01 +0100
"Curiouser and curiouser, said Alex"
OK, here is what I tried on a test ZClass ("infos" is a propertysheet name):
<UL>
<dtml-with "myZClassInstance.propertysheets.infos">
<dtml-in "propertyIds()">
<LI><dtml-var sequence-item> -
<dtml-var "getPropertyType(_['sequence-item'])"> -
<dtml-var "getProperty(_['sequence-item'])"> -
<dtml-var "propertyLabel(_['sequence-item'])"> -
<dtml-var "hasProperty(_['sequence-item'])">
</dtml-in>
</dtml-with>
</UL>
And here is what I got:
title - string - Site du Gisti - title - 1
description - None - C'est le site du Gisti. - description - 1
adresse - None - http://www.gisti.org - adresse - 1
lien - None - Site du Gisti - lien - 1
mots_cles - None - ['Gisti', 'site', 'le poulpe', "l'afrique"] -
mots_cles - 1
So everything is working fine *except* getPropertyType(). This doesn't work
any better:
<dtml-var
"myZClassInstance.propertysheets.infos.getPropertyType('description')">
I also get "None". I used propertyMap() as a workaround but I'm puzzled.
Did I miss something? (I use Zope 2.1b2 on Win NT4).
Cheers.
Alexandre
At 14:54 21/11/1999 -0800, Jonothan Farr wrote:
> > I tried to list all properties in a ZClass instance and check their types.
> > I used the following code (within the ZClass; 'infos' is a custom
> > propertysheet name):
> >
> > <dtml-in "propertysheets.infos.propertyIds()">
> > <LI><dtml-var sequence-item> -
> > <dtml-var "getPropertyType(_['sequence-item'])"> -
> > <dtml-var "hasProperty(_['sequence-item'])">
> > </dtml-in>
> > </UL>
> >
> > This is the result:
> >
> > title - string - 1
> > description - None - 0
> > adresse - None - 0
> > modele_lien - None - 0
> > lien - None - 0
>
>It looks like you need to call "propertysheets.infos.getPropertyType(...)" and
>"propertysheets.infos.hasProperty(...)".
>
>--jfarr