Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to replace ElementTree
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Remi Jolin  
View profile  
 More options Sep 28 2012, 11:47 am
From: Remi Jolin <remi.jo...@sysgroup.fr>
Date: Fri, 28 Sep 2012 17:47:42 +0200
Local: Fri, Sep 28 2012 11:47 am
Subject: How to replace ElementTree
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mengu  
View profile  
 More options Sep 28 2012, 2:50 pm
From: Mengu <whalb...@gmail.com>
Date: Fri, 28 Sep 2012 11:50:55 -0700 (PDT)
Local: Fri, Sep 28 2012 2:50 pm
Subject: Re: How to replace ElementTree

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>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Remi Jolin  
View profile  
 More options Sep 28 2012, 3:12 pm
From: Remi Jolin <remi.jo...@sysgroup.fr>
Date: Fri, 28 Sep 2012 21:12:06 +0200
Local: Fri, Sep 28 2012 3:12 pm
Subject: Re: [TurboGears] Re: How to replace ElementTree
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 :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mengu  
View profile  
 More options Sep 28 2012, 6:30 pm
From: Mengu <whalb...@gmail.com>
Date: Fri, 28 Sep 2012 15:30:11 -0700 (PDT)
Local: Fri, Sep 28 2012 6:30 pm
Subject: Re: [TurboGears] Re: How to replace ElementTree

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Remi Jolin  
View profile  
 More options Sep 29 2012, 5:48 am
From: Remi Jolin <remi.jo...@sysgroup.fr>
Date: Sat, 29 Sep 2012 11:48:07 +0200
Local: Sat, Sep 29 2012 5:48 am
Subject: Re: [TurboGears] Re: How to replace ElementTree
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »