Yes, I know this is a solution, but the example I gave is not really
representative of what I want to display, and, in a process of migrating
some applications from TG1 to TG2, I want to do minimal changes :-)
Le 29/09/2012 00:30, Mengu a écrit :
you totally don't need that filter.
in your controller action pass the upd_link variable in your dict, so
it's like this:
def my_action(self):
upd_link = "/some/link/%s" % value
return dict(upd_link=upd_link)
and in your template you just do <a href="{{ upd_link }}">update</a>.
that is really just all. you don't need anything else.
On Friday, September 28, 2012 10:12:28 PM UTC+3, Remi Jolin wrote:
I think it is because TG1/genshi has autoescaping enabled and I have
enabled autoescape in jinja too.
ET is also a convenient way to build html structures when things
get a
bit more complicated :-)
By the way, I found a solution with a custom filter, so I can write
something like <a href="{{ upd_link|et }}">update</a>
Le 28/09/2012 20:50, Mengu a �crit :
> hi remi,
>
> is there any special reason building the html element with element
> tree? you certainly can use the value in your template.
>
> <a href="{{ upd_link }}">update</a>
>
> On Friday, September 28, 2012 6:47:50 PM UTC+3, Remi Jolin wrote:
>
> Hello,
>
> Still trying to get my marks with TG2.2 :-)
>
> With TG1/genshi when I wanted to include some html pieces
dynamically
> generated is used ElementTree
> for example :
> upd_link = ET.Element('a', href='/xxx/%s' % value)
> upd_link.text = 'some text'
>
> and I passed this value in the returned dict.
>
> In genshi I simply add something like
> <a py:replace="upd_link">place holder</a>
>
> Now I tried to do the same with TG2.2 and jinja ({{ upd_link
}})
> but I
> can't get anything displayed (no error, but nothing generated).
>
> So how can I get the same result I had with TG1 ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/v-nJZb4YLJ8J
<https://groups.google.com/d/msg/turbogears/-/v-nJZb4YLJ8J>.
> To post to this group, send email to [email protected]
<javascript:>.
> To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en
<http://groups.google.com/group/turbogears?hl=en>.
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/turbogears/-/NOImcsxIkKgJ.
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.
--
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.