Le mardi 22 mai 2007 à 13:07 -0700, Uwe C. Schroeder a écrit :
> Template snippet:
>
> <div><ul>
> <py:for each="item in lists">
> ${ET(item.code)}
> </py:for>
> </ul></div>
Do you mean ${XML(item.code)} instead ?
>
> Problem is the ET call in the template, and I can only assume that the
> ${profile['uid']} will be the second.
>
> The way I think this should happen is
>
> a) controller issues above "item.code" output
> b) that output is placed literally into the template via the ET call
> c) the template is then rendered
>
>
> My reason for emitting the html markup from the controller is the later ajax
> calls. The <li> id parameter is generated, so that a later ajax call will
> send the id and the user id and receives a the content of the <li> tag as
> result. That way I would have a very generic and short javascript function
> to replace the content of each individual LI tag with the new one.
Please wrap your lines when writing email to a mailing list...
> Well, I guess it's not that simple, since the ET call fails (traceback
> below). The only other way of doing this (I can think of) is to render the
> page
> without injected markup (speak: place all the dynamic stuff into the template
> itself) and then write another controller method which will emit
> the code for the ajax calls since those don't go thru the template engine but
> are dealt with on the client side directly.
maybe you should just pass a callable that returns an xml.etree.Element
(with subelements in there of course)
I would do this like the following and then my web designer who does CSS
would like me even more :)
first in the controller (I put some dummy stuff to emulate yours):
http://paste.turbogears.org/paste/1314
then in the template:
http://paste.turbogears.org/paste/1315
as you can see I imagined some simplified model (Item class here) to
emulate yours but I think this is one way to get what you want.
The js code is also simplified because I did not know what was profile
(a dictionnary of something it seems).
This code was tested in a quickstarted TG 1.0.2.2 app with genshi
templating.
Hope it helps,
Florent.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---