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 __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/
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) -----------------------------------------------------------------------
I tried this <p tal:define="category_id request/form/category;category python:getattr(here, category_id);"> </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 still gives Error Type: KeyError Error Value: 'category' --- "SER.RI-TIC-Alexis Roda" <alexis.roda@urv.net> wrote:
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)
-----------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
john blair escribió:
I tried this <p tal:define="category_id request/form/category;category python:getattr(here, category_id);"> </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 still gives
Error Type: KeyError Error Value: 'category'
--- "SER.RI-TIC-Alexis Roda" <alexis.roda@urv.net> wrote:
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)
-----------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Try: <p tal:define="category_id request/form/category;*global* category python:getattr(here, category_id);"> </p> <table> <tr tal:repeat="item category/objectValues"> <td tal:content="item/id">Id</td> <td tal:content="item/title">Title</td> </tr> </table> or <p tal:define="category_id request/form/category;category python:getattr(here, category_id);"> <table> <tr tal:repeat="item category/objectValues"> <td tal:content="item/id">Id</td> <td tal:content="item/title">Title</td> </tr> </table> *</p>*
john blair wrote:
<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>
Try this: <table tal:define="category request/form/category|nothing" tal:condition="category"> <tr tal:repeat="item here/?category/objectValues"> <td tal:content="item/id">Id</td> <td tal:content="item/title">Title</td> </tr> </table> cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (4)
-
Chris Withers -
Garito -
john blair -
SER.RI-TIC-Alexis Roda