[Zope] zcatalog and zpt question

Dieter Maurer dieter@handshake.de
Sun, 12 May 2002 09:55:01 +0200


Mark Lilly writes:
 > I have a python script which returns mybrains instances from a catalog.
 > here's the code:
 > return context.Tasks.Catalog({'id' : task_id})
 > 
 > i want to retrieve the meta data values in a template.
 > so far i have this, which doesn't work, saying that task_name is not defined
 > in task, even though task_name is a meta data piece in the catalog.
 >  <span tal:define="task
 > python:root.CT.Scripts.P_Scripts.getTask('20020507125159')"
 >          	tal:replace="task/task_name"></span> 
Catalog searches return a *sequence* of hits.
You need to access a single hit.
You use subscription, in the form "tasks[0]" (the first hit, or an
exception, if the sequence is empty).


Dieter