[Zope] getPropertyType

marc lindahl marc@bowery.com
Sat, 05 May 2001 11:46:37 -0400


Tim, 
take a look at the python/OFS/dtml/properties.dtml code.

Something more like:

<dtml-in details.propertyMap mapping>  -- not sure about that part, since
properties.dtml is not for a subsheet.

but anyway, use the mapping

then you'd have:


<tr>
<th align="left"><dtml-var propertyLabel(id)></th>
<td><dtml-if "type =='text'">
 <textarea name="<dtml-var id>:text" rows="6" cols="35"><dtml-var
   "getProperty(id)" html_quote></textarea>
<dtml-else>
  <input type="text" name="<dtml-var id>:<dtml-var
   type>" size="35" value="<dtml-if "hasProperty(id)"><dtml-var
   "'%s' % getProperty(id)" html_quote></dtml-if>">
</dtml-if></td>
</tr>

...but I'd suggest studying properties.dtml the code there is much more
complete.


> From: "Tim Hicks" <tim@sitefusion.co.uk>
> Date: Sat, 5 May 2001 16:16:02 +0100
> To: <zope@zope.org>
> Subject: [Zope] getPropertyType
> 
> 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']">
> <tr>
> <th align="left"><dtml-var pid></th>
> <td><dtml-if "propertysheets.details.getPropertyType(pid) ==
> 'text'"><textarea  name="<dtml-var pid>"><dtml-var
> "propertysheets.details.getProperty(pid)"></textarea><dtml-else><input
> type=text name="<dtml-var pid>" value="<dtml-var
> "propertysheets.details.getProperty(pid)">"></dtml-if></td>
> <td><dtml-var "propertysheets.details.getPropertyType(pid)"></td>
> </tr>
> </dtml-let>
> </dtml-in>
> 
> And here is a sample of what it generates.
> 
> <tr>
> <th align="left">name</th>
> <td><input type=text name="name" value="Tim Hicks"></td>
> <td>None</td>
> </tr>
> <tr>
> <th align="left">email</th>
> <td><input type=text name="email" value="tim@sitefusion.co.uk"></td>
> <td>None</td>
> </tr>
> 
> 
> Any ideas?
> 
> tim
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )