Is it web2py template code that you want to execute, or just plain Python?
If the former, you can use the gluon.template.render function --
see https://groups.google.com/d/msg/web2py/4r65UNLQTgQ/SxkW2zzsuwwJ. If the
latter, there is always eval/exec. In either case, be aware of the security
risk -- if the content comes from users, very bad things can happen (even
inadvertently rather than maliciously).
Anthony
On Saturday, February 22, 2014 6:31:05 PM UTC-5, Robin Manoli wrote:
>
> Suppose db.page.content has some text like : {{ arbitrary python code }}.
> Would this python code then be executed? Is it possible to execute such
> code?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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.