[Zope] Re: Defining a dictionary in ZPT?

michael nt milne michael.milne at gmail.com
Thu Nov 1 19:41:48 EDT 2007


1) don't make spaces around = in HTML attributes:
        tal:define="query here/testquery"

a mistake

2) Why do you use repeat['result'] ? Can you point us to documentation
where did you read it ?
   tal:replace="result/firstname"  should work as expected or
   tal:replace="python:result[ 'firstname']" in case of result is
dictionary and you need to use python: for some reason.

http://wiki.zope.org/ZPT/RepeatVariable

requires repeat to be called. I used this as previously using
tal:replace="result/firstname produced a keyerror as I had no dictionaries
set up. The repeat variable sets-up a dictionary automatically...


3) what testquery returns ? I suppose it returns method, because you are
calling this method wit parameter 'id', but I don't think you meant it
in this way.

testquery returns a ZSQL query which works and is tested. The id variable is
totally meant as we are passing through a dynamic variable from a ZPT page
through to the ZSQL query. At the moment to simplify things! (required..)
this variable is fixed to 'IT'.

Thanks for your help


On 11/1/07, Radim Novotny <novotny.radim at gmail.com> wrote:
>
> michael nt milne napsal(a):
> > 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>&nbsp;
> >   </li>
> >
>
> 1) don't make spaces around = in HTML attributes:
>          tal:define="query here/testquery"
>
> 2) Why do you use repeat['result'] ? Can you point us to documentation
> where did you read it ?
>     tal:replace="result/firstname"  should work as expected or
>     tal:replace="python:result['firstname']" in case of result is
> dictionary and you need to use python: for some reason.
>
> 3) what testquery returns ? I suppose it returns method, because you are
> calling this method wit parameter 'id', but I don't think you meant it
> in this way.
>
> --
> Radim Novotny
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20071101/09e31019/attachment.htm


More information about the Zope mailing list