zcatalog and zpt question
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> How do i get at the pieces of meta data in a catalog through ZPT?? Thanks, mark
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
participants (2)
-
Dieter Maurer -
Mark Lilly