getPropertyType returns None in ZClass
Hello, 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 The property names are available but all properties except built-in 'title' are described as missing (though they do store data I can retrieve and display). This doesn't happen when I run the same code on a standard object type outside a Zclass. Also, the propertyMap() method returns the correct info. Eg.: <UL> <dtml-in "propertyMap()"> <LI><dtml-var sequence-item> </dtml-in> </UL> returns {'id': 'title', 'type': 'string', 'meta': {}, 'mode': 'w'} {'id': 'description', 'type': 'text', 'meta': {}, 'mode': 'w'} {'id': 'adresse', 'type': 'string', 'meta': {}, 'mode': 'w'} {'id': 'modele_lien', 'type': 'string', 'meta': {}, 'mode': 'w'} {'id': 'lien', 'type': 'string', 'meta': {}, 'mode': 'w'} What did I missed? Thanks. Alexandre
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
"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
participants (2)
-
Alexandre Ratti -
Jonothan Farr