So doing some more routing around on the lists I saw this advice<br><br>> FWIW you<br>> might want to call the query or execute methods directly on the DA<br>> connection object if they are supported.<br><br>Therefore my db connection object is
<br> <br>ado_db_connection. Modifying my code to the below and calling the query method of the adapter now gives me an 'insufficient priviledges' in my Plone site...Nearly there I feel. Strange as I am logged in as the uberuser...
<br><br> <ul><br><li tal:define="query here/testquery" tal:repeat="result python:context.ado_db_connection().query(id='IT')"><br><span tal:replace="repeat/result/firsname">firstname goes here</span>
<br> </li><br></ul><br><br><br><div><span class="gmail_quote">On 11/2/07, <b class="gmail_sendername">michael nt milne</b> <<a href="mailto:michael.milne@gmail.com">michael.milne@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
ps for completeness<br><br>here is the testquery ZSQL which works fine when tested in the ZMI and manually inputting the id variable.<br><br>select * from tblEmployees where department = (<dtml-sqlvar id type="string">) order by 'location'
<br><br>I have 'id' in the argument field<br><br>Thanks<div><span class="e" id="q_115ffa398522500b_1"><br><br><div><span class="gmail_quote">On 11/2/07, <b class="gmail_sendername">michael nt milne</b> <<a href="mailto:michael.milne@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
michael.milne@gmail.com </a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Hi Josef<br><br><br><br><ul><span><br><li tal:define="query here/testquery" tal:repeat="result python:query(id='IT')"><br></span><span tal:replace="repeat/result">firstname goes here</span>
<br> </li><br></ul><br><br>gives the same<span><br><br>> AttributeError: Results instance has no __call__ method<br><br></span>As does<span><br><br><span tal:replace="repeat/result/firstname">First Name</span>
<br><br></span>As does<br><br><span tal:replace="result/firstname">First Name</span><br><br>!<br><br>Thanks for your help. Not easy this ZPT!, even when you have read the documentation :-)<div><span>
<br><br><div><span class="gmail_quote"> On 11/2/07, <b class="gmail_sendername">Josef Meile</b> <<a href="mailto:jmeile@hotmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jmeile@hotmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Hi Michael<br><br>michael nt milne schrieb:<br>> yeah I have modified to this<br>><br>> <li tal:define = "query here/testquery"<br>> tal:repeat="result python:query(id='IT')">
<br>> <span tal:replace="python:repeat['result'].firstname">First<br>> Name</span><br>> </li><br>><br>> but get this as a result. Thanks for the reply.<br>><br>> Module
Products.PTProfiler.ProfilerPatch, line 32, in __patched_call__<br>> Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__<br>> - __traceback_info__: query(id='IT')<br>> Module Python expression "query(id='IT')", line 1, in <expression>
<br>> AttributeError: Results instance has no __call__ method<br>I suspect that result isn't a dictionary. Why don't you try to print<br>result instead and see its type? Try this:<br><br><span tal:replace="repeat/result"></span>
<br><br>You could also try the other sintax for your zpt:<br><span tal:replace="repeat/result/firstname">First Name</span><br><br>Regards<br>Josef<br>_______________________________________________<br>
Zope maillist - <a href="mailto:Zope@zope.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Zope@zope.org</a><br><a href="http://mail.zope.org/mailman/listinfo/zope" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.zope.org/mailman/listinfo/zope</a><br>** No cross posts or HTML encoding! **<br>(Related lists - <br><a href="http://mail.zope.org/mailman/listinfo/zope-announce" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.zope.org/mailman/listinfo/zope-announce</a><br><a href="http://mail.zope.org/mailman/listinfo/zope-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.zope.org/mailman/listinfo/zope-dev
</a> )<br></blockquote></div><br><br clear="all"><br></span></div>-- <br><span>michael </span></blockquote></div><br><br clear="all"><br></span></div>-- <br><span class="sg">michael </span></blockquote></div><br><br clear="all">
<br>-- <br>michael