"michael nt milne" <michael.milne@gmail.com> wrote:
<li tal:define = "query here/testquery" tal:repeat="result python:query(id='IT')"> <span tal:replace="python:repeat['result'].firstname">First Name</span> </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 it: tal:define="query nocall:here/testquery"