> > The templating is working as designed and it's pretty responsive
> > subjectively speaking.  For those who might be interested, I'll post
> > some code and benchmarks after taking some time to clean up the code
> > and figure out a "safe" way to use eval within the template.
>
> You should avoid 'eval', at least in any context where the input could
> come from a remote user by way of URL, post data, query string etc
> etc. What are you trying to do that requires eval?
>
> Graham

to process python code between the <% %> tags, e.g.

<%
def fib(n):
    a, b = 0, 1
    while b < n:
        print(str(b) + ", ")
        a, b = b, a+b
    return b-a

var = fib(100)
%>
<br><br>
{var}

looks like this in a browser:

"""
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,

55
"""

here the the print statement is modified to just return output to the
browser.  Also, variables surrounded by "{" "}" are returned to the
browser based on the variables in locals().  I'm still holding out
hope that there'll be a way to make eval safe or maybe figure out a
better alternative to allow scripting in the template.

-Walter






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to