Both solutions work like a charm, guru - thanks! And come to think of it, 
the HTML helper solution is so much cleaner than the HTML route that I 
think I should reconsider that aspect of the page.

Also, thanks for the security warning. It wasn't production code, just an 
ad hoc example that popped up, probably thanks to the effects of priming, 
as I was doing something with "request.vars.whatever" just before that.

-Lamps

On Wednesday, March 20, 2013 1:15:01 PM UTC-5, guruyaya wrote:
>
> I think the best way to address this problem is using the A tag, like this:
> stored_code = A(request.vars.the_link, _href=request.vars.the_link)
> or, if you insist
> stored_code = XML("<a href='%(link)s'>%(link)s</a>" % {'link': 
> request.vars.the_link})
>
> PS - I sure hope it's not a code sample, cauz you're just screeming for 
> hackers to spam you with links to thier website.
>
> On Wednesday, March 20, 2013 7:16:14 PM UTC+2, Lamps902 wrote:
>>
>> It's possible to render HTML code stored in a variable with the XML() 
>> function (i.e. if your variable is "stored_code", do "XML(stored_code)"
>> to render). However, let's say you have something like the following 
>> scenario:
>>
>> stored_code = "<a href='{{=request.vars.the_link}}'>{{=request.vars.
>> the_link}}</a>"
>>
>> or something like
>>
>> stored_code = "<a href='request.vars.the_link'>request.vars.the_link</a>"
>>
>> Is there a way to get web2py to evaluate the variables and render the 
>> HTML with the evaluated values? Thanks.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to