Here's your original method: >>> links = "<li><a href='app_path/view/user_a'>user_a</a></li>" >>> print response.render('invite_friend.html', dict(links=links)) <html> Hello there, <ul> <li><a href=& #x27;app_path/view/user_a'>user_a</a></li> <ul> </html>
As you can see, the HTML tags in links are getting escaped in the call to response.render(), so the HTML displays literally in the output instead of being rendered as HTML. Now, here it is wrapping the links HTML in XML(): >>> links = XML("<li><a href='app_path/view/user_a'>user_a</a></li>") >>> print response.render('invite_friend.html', dict(links=links)) <html> Hello there, <ul> <li><a href='app_path/view/user_a'>user_a</a></li> <ul> </html> Now the links HTML is being rendered properly. One problem I notice, though, is that your have <ul> instead of </ul> to close the list -- maybe that's why it's still not rendering as you expect. Anthony On Tuesday, June 5, 2012 5:17:08 AM UTC-4, Sushant Taneja wrote: > > This does not work. Still facing the same issue. > > On Monday, June 4, 2012 8:57:34 PM UTC+5:30, Anthony wrote: >> >> By default, the template engine escapes everything -- to avoid that, do: >> >> links = XML("<li><a href='app_path/view/user_a'>user_a</a></li>") >> >> See http://web2py.com/books/default/chapter/29/5#XML. >> >> Anthony >> >