Re: [web2py] Storing Python code in db?

2013-01-19 Thread Bruno Rocha
http://docs.python.org/2/library/pickle.html


http://python.about.com/od/pythonstandardlibrary/a/pickle_intro.htm

-- 





[web2py] Storing Python code in db?

2013-01-18 Thread Kenny Chung
I am testing out to store Python code and run it by extracting it from the
database.
It looks simple but it's giving me a weird error.

*//Code*
{{a=row.temp}} //question.temp is "def f(x):\nx = x + 1\ny = 10\n
 return x + y" same as below
{{b="def f(x):\nx = x + 1\ny = 10\nreturn x + y"}}
{{=a}} 
{{=b}}

*//Result*
def f(x):\n x = x + 1\n y = 10\n return x+y
def f(x): x = x + 1 y = 10 return x + y

As you can see, 'a' still has "\n" in it when 'b' doesn't. What is causing
this problem?

Also, what would be the best way to store something like that?


Thank you.

--