[Zope] traversal problem

SER.RI-TIC-Alexis Roda alexis.roda at urv.net
Fri Mar 4 07:27:55 EST 2005


john blair wrote:
> Hi I have say 3 folders with following ids
> folder1
> folder2
> folder3
> 
> Now I show this list to the user in a comno box. User
> selects folder which results in displaying of the
> contents of that folder.
> Say the select box name is category
> i.e <select name="category">
> now when the user selects one of the category what I
> do is
> <p tal:define="category request/form/category"> </p>
>   <table>
>     <tr tal:repeat="item category/objectValues"> 
>           <td tal:content="item/id">Id</td>
>           <td tal:content="item/title">Title</td>
>     </tr>
> </table>
> 
> It gives me a key error .What should I do to correctly
> traverse the folder

category is a string, try with something like:

<div tal:define="category_id request/form/category;
                  category python:getattr(here, category_id);
                 ">
  ...
</div>



HTH
-- 
                                    ////
                                   (@ @)
----------------------------oOO----(_)----OOo--------------------------
<>               Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
-----------------------------------------------------------------------



More information about the Zope mailing list