[Zope] Re: Defining a dictionary in ZPT?

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Fri Nov 2 07:37:53 EDT 2007

"michael nt milne" <michael.milne at gmail.com> 

><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

That is because you already called the function.

The tal:define="query here/testquery" is (roughly) equivalent to: 
tal:define="query python:here.testquery()". If you want to use a path 
expression which evaluates to something callable so that you have a shorter 
name later when you call it then you explicitly say you don't want to call 

   tal:define="query nocall:here/testquery"

More information about the Zope mailing list