ok, thanks Duncan

<ul>
<li tal:define="query nocall:here/testquery" tal:repeat="result python:query(id='IT')">
<span tal:replace="result/lastname">lastname goes here</span>

</li>
</ul>

works! I went down a blind alley with calling the database adapter due to confusion over the error message produced. Backs up my point about more friendly and usable error messages.

Much appreciated!

On 11/2/07, Duncan Booth <duncan.booth@suttoncourtenay.org.uk> wrote:
"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>&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
it:

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

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )



--
michael