I have a python script, getCatalogItems(), which returns a (possibly empty) list resulting from a catalog query. The lone parameter is the sort index; the rest of the query is taken from the request. Anyhow...
If nothing was found, I don't want to display an empty table of results.

When I do this query and then check for empty list to see if the query returned any items:

<div tal:define="items python:container.getCatalogItems('id')">
<table tal:condition="python: items!=[]">
... doesn not work, that is, the (empty) table displays when items is in fact an empty list.

If I do this instead:

<div tal:define="items python:container.getCatalogItems('id')">
<table tal:condition="python: len(items)>0">

...then the condition works, no empty table is displayed if the list is empty.

Why does the former not work and the latter does?
I need to understand the difference in the python expressions...makes no sense to me at present that they don't work the same.

thanks for any help,
John S.


John Schinnerer - MA, Whole Systems Design
- Eco-Living -
Whole Systems Design Services
People - Place - Learning - Integration
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to