[ZPT] python to zpt

robert robert at redcor.ch
Mon Jul 21 10:34:20 EDT 2003


call your script getRecords
change it like so:
rec = context.test_select_sql()
recordset = rec.dictionaries()
return recordset

then in a template
<table>
  <tr tal:repeat="record here/getRecords">
      <td tal:repeat="key python:record.keys()" tal:content="python:'%s=%s' % 
(key, record[key]"></td>
  </tr>
</table>

This is untested but should give you the idea
Robert

Am Montag, 21. Juli 2003 09:06 schrieb Exteam:
> hi all,
> i'm stuck at this point,
> can some one convert the following python code in to
> zpt & help me.
> i'm not able to convert it in to zpt.
> --------------------------------
> rec = context.test_select_sql()
> print "Fields definitions"
> recordset = rec.dictionaries()
> rownum = 1
> for record in recordset:
>   print "Row %d" % (rownum), "check", record
>   rownum = rownum + 1
> for key in record.keys():
>        print key, "=", record[key]
>        print "-" * 80
> return printed
> ---------------------------
> plz help me
> thanks
>
> ________________________________________________________________________
> Send free SMS using the Yahoo! Messenger. Go to
> http://in.mobile.yahoo.com/new/pc/
>
> _______________________________________________
> ZPT mailing list
> ZPT at zope.org
> http://mail.zope.org/mailman/listinfo/zpt

-- 
mit freundlichen Grüssen

Robert Rottermann
www.redCOR.ch




More information about the ZPT mailing list