Am Mittwoch, den 28.09.2005, 16:32 +1000 schrieb Julian Yap: > --- Chris Withers <[EMAIL PROTECTED]> wrote: ... > > Now, if you really can't stop your sql returning more than one > > row > > (LIMIT 1 anyone?) then how about: > > > > <tr tal:define="customers container/getCustomerLicences; > > customer python:customers and customers[0]" > > tal:condition="customer"> > > <td> > > Customer: > > <span tal:content="customer/full_name"></span> > > </td> > > </tr> > > To have my SQL returning only just 1 row would require another Z > SQL Method, in which case it may as well be something like > getCustomer. > > I'm still getting my head around TAL and how it works so I'm not > sure how the "python:customers and customers[0]" code works. > > Ideally, I want to use just the one Z SQL method (done) but I > guess it would be better coding to just reference the Z SQL > method once. Currently the page template makes two calls to the > Z SQL method. Once for the customer header and another to > retrieve the customer license details. Can you suggest how this > would be done?
You could just wrap it in a simple python script: results=context.yourZSQLMethod() h=results[:1] # see python slice b=results[1:] return context.yourPageTemplate(header=h,body=b) And in your ZPT use tal:repeat="chead options/header" and options/body But maybe you can rething and rephrase your problem :-) _______________________________________________ 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 )