[ZPT] python to zpt

robert robert at redcor.ch
Mon Jul 21 12:22:29 EDT 2003


instead of:
<td tal:repeat="key python:record.keys()"
> > tal:content="python:'%s=%s' %
> > (key, record[key]"></td>
you just use:
<td tal:content="python: record['XXX']"></td>
Robert
Am Montag, 21. Juli 2003 10:20 schrieb Exteam:
> Thanks a lot Robert,
> my only problem is refering to a particular column
> name in the db table.
> suppose i have 2 columns (a & b )in my DB table , i
> want to print only records in column a.
> is this possible in the script we have?
> thanks a lot again
> prasad
>
>  --- robert <robert at redcor.ch> wrote: > 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
>
> ________________________________________________________________________
> Send free SMS using the Yahoo! Messenger. Go to
> http://in.mobile.yahoo.com/new/pc/

-- 
mit freundlichen Grüssen

Robert Rottermann
www.redCOR.ch




More information about the ZPT mailing list