[ZPT] How to accomplish the following using ZPT and Python.

Robert Rottermann robert@redcor.ch
Thu, 2 May 2002 07:48:28 +0200


I hope I understand your question!
Do it as follows:
you have three things.
1. a script called feeder returning data. It takes a parameter "which"
selecting what data to return
   return [{'name':'Robert', 'title':'man in the moon'}.....]
2. a  template calle slave.html
<table>
  <tr tal:repeat="row python:here.feeder(which=options.which)">
     <td tal:content="row/name"></td>
     <td tal....></td>
  </tr>
</table>
3. a script called homuch that says how often
  return 5
4. the "main" template
<table>
  <tr tal:repeat="num here/howmuch">
     <td tal:content="struct python:here.slave(which=num)"></td>
  </tr>
</table>

you end with a table of 5 tables
Robert

----- Original Message -----
From: "Alec Munro" <alec.munro@eoascientific.com>
To: <zpt@zope.org>
Sent: Tuesday, April 30, 2002 8:55 PM
Subject: [ZPT] How to accomplish the following using ZPT and Python.


> Hi all,
> I'm a newbie, so if necessary, point out the obvious.
> I've got an index page that is going to display three lists of different
> types of items.
> What I want is to be able to put a call in that template to a python
> script, with a variable number of arguments, in the event that I want to
> display less than the three lists.
> I want to have another template that contains the formatting for the
> list, and I want my python script to call this template once for each
> argument it receives. The template would then pass that argument on to a
> ZSQL method that would retrieve the appropriate information from the
> database.
>
> Tell me what I can't do out of these, followed by what I can do, but
> would complexify it to much to be worth it.
> Thanks for your time, I know this a pretty generic problem, but I really
> appreciate any help.
> Alec Munro
>
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>