[Zope] Re: Defining a dictionary in ZPT?
michael nt milne
michael.milne at gmail.com
Fri Nov 2 05:14:12 EDT 2007
ps for completeness
here is the testquery ZSQL which works fine when tested in the ZMI and
manually inputting the id variable.
select * from tblEmployees where department = (<dtml-sqlvar id
type="string">) order by 'location'
I have 'id' in the argument field
Thanks
On 11/2/07, michael nt milne <michael.milne at gmail.com> wrote:
>
> Hi Josef
>
>
>
> <ul>
> <li tal:define="query here/testquery" tal:repeat="result
> python:query(id='IT')">
> <span tal:replace="repeat/result">firstname goes here</span>
> </li>
> </ul>
>
> gives the same
>
> > AttributeError: Results instance has no __call__ method
>
> As does
>
> <span tal:replace="repeat/result/firstname">First Name</span>
>
> As does
>
> <span tal:replace="result/firstname">First Name</span>
>
> !
>
> Thanks for your help. Not easy this ZPT!, even when you have read the
> documentation :-)
>
> On 11/2/07, Josef Meile <jmeile at hotmail.com> wrote:
> >
> > 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>
> > > </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
> > _______________________________________________
> > Zope maillist - Zope at 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
--
michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20071102/169de147/attachment.htm
More information about the Zope
mailing list