[Zope] NEWBIE: dtml-in and subobjects

Thomas Weiner weiner@tu-harburg.de
Mon, 20 Mar 2000 14:52:24 +0100


geoff@northernwastes.org schrieb:
> 
> Quoting sam <linuxcraft@redspice.com>:
> 
> > Have you tried
> > <dtml-with containerObject>
> > <dtml-in "objectValues('whatever class name')">
> > I have not tried this myself but suspect is what you
> need
> 
> Hmmm.  Tried that, but still no luck.  Zope give me a
> NameError, and tells me method is trying to reference a
> nonexistent variable (fullname).  Here's the current
> draft of my code:
> 
> <table>
>   <tr>
>     <th>Name</th>
>     <th>Description</th>
>   </tr>
>   <dtml-with bwlib_abilities>
>     <dtml-in "fullname('AbilityClass')">
>       <tr>
>         <td><dtml-var fullname></td>
>         <td><dtml-var description></td>
>       </tr>
>     </dtml-in>
>   </dtml-with>
> </table>
> 
> Where bwlib_abilities is the name my container class,
> AbilityClass is the subclass in question, fullname is
> the sorting criterea and a poperty of AbilityClass, and
> description is also a property of that subclass.

Your need a list of the AbilityClass instances in 'bwlib_abilities',
which you can sort by fullname. Assuming 'AbilityClass' is the meta-type
of your subclass, try something like the following: 

<dtml-with bwlib_abilities>
     <dtml-in "objectValues('AbilityClass')" sort=fullname>
       <tr>
         <td><dtml-var fullname></td>
         <td><dtml-var description></td>
      </tr>
     </dtml-in>
</dtml-with>

hth,
Thomas