[Zope] getPropertyType

Tim Hicks tim@sitefusion.co.uk
Sat, 5 May 2001 16:16:02 +0100

I have a zclass that has a property sheet called 'details' and I am trying
to create a form for editing this that goes through the property sheet
(using dtml-in) and creates the correct input box.  Everything works, except
the getPropertyType part, which always returns 'None'.  The ZQR says that it
will do this when the property doesn't exist, but the property clearly does
exist as propertyIds() finds it, a getProperty() does actually return the
value of the property.  I just want to see what sort of property it is so
that I can present the correct type of input box.

Here's the code snippet.

<dtml-in "propertysheets.details.propertyIds()">
<dtml-let pid="_['sequence-item']">
    <th align="left"><dtml-var pid></th>
    <td><dtml-if "propertysheets.details.getPropertyType(pid) ==
'text'"><textarea  name="<dtml-var pid>"><dtml-var
type=text name="<dtml-var pid>" value="<dtml-var
    <td><dtml-var "propertysheets.details.getPropertyType(pid)"></td>

And here is a sample of what it generates.

    <th align="left">name</th>
    <td><input type=text name="name" value="Tim Hicks"></td>
    <th align="left">email</th>
    <td><input type=text name="email" value="tim@sitefusion.co.uk"></td>

Any ideas?