[Zope] Output only the first or a particular record using TAL

Julian Yap julian_yap at yahoo.com
Wed Sep 14 00:48:49 EDT 2005


Hi all,

I wanted to create something of a header using TAL and a Z SQL Method.

I have the following code where getCustomerLicenses is my Z SQL Method and
it prints out the customer's full name with details:
<tr tal:repeat="licenses container/getCustomerLicences">
    <td><span tal:replace="licenses/full_name">full_name</span></td>
    <td><span tal:replace="licenses/serial_number">serial_number</span></td>
<!-- code continues with more details -->
</tr>

In it's simplest form, how do I retrieve just the full_name of the first
record using TAL.  I think I use tal:replace but I'm not sure.

I was along the lines of something like this:
<tr tal:define="x container/getCustomerLicences">
    <td tal:replace="x/full_name[0]></td>
</tr>

But then I just get a TypeError.

I guess if I get this working, I can start playing around with conditions
but I'm stuck!

Thanks,

Julian Yap



More information about the Zope mailing list