Julian Yap wrote:
I used the following and it works great (without some formatting for
clarity):
<tr tal:define="customer container/getCustomerLicences"
tal:condition="customer">
<td>Customer: <span
tal:content="python:customer[0]['full_name']"></span></td>
</tr>
hmm, this strikes me as just plain wrong :-S
Why is getCustomerLicenses returning more than one row if you only want
the first one?
If it only returned one row, then you could do:
<tr tal:repeat="customer container/getCustomerLicences">
<td>
Customer:
<span tal:content="customer/full_name"></span>
</td>
</tr>
...no need for the condition or the yucky integer indexes.
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>
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
_______________________________________________
Zope maillist - [email protected]
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 )