[Zope] Re: Defining a dictionary in ZPT?

Josef Meile jmeile at hotmail.com
Fri Nov 2 05:02:11 EDT 2007


Hi Michael

michael nt milne schrieb:
> yeah I have modified to this
> 
> <li tal:define = "query here/testquery"
>      tal:repeat="result python:query(id='IT')">
> <span tal:replace="python:repeat['result'].firstname">First 
> Name</span>&nbsp;
>   </li>
> 
> but get this as a result. Thanks for the reply.
> 
> Module Products.PTProfiler.ProfilerPatch, line 32, in __patched_call__
> Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
> - __traceback_info__: query(id='IT')
> Module Python expression "query(id='IT')", line 1, in <expression>
> AttributeError: Results instance has no __call__ method
I suspect that result isn't a dictionary. Why don't you try to print
result instead and see its type? Try this:

<span tal:replace="repeat/result"></span>

You could also try the other sintax for your zpt:
<span tal:replace="repeat/result/firstname">First Name</span>

Regards
Josef


More information about the Zope mailing list