ok, i am stuck. i have studied run_controller_in and restricted and i
tried some test code attempts and i am stuck. so here is some sample code:
xx2 = """
def lucas53():
harry = (4+16)/2
rtn = dict(harry=harry)
return rtn
"""
and under a web2py controller function:
env = {}
exec xx2 in env
lst = env
body.append(P(lst))
where body is just a DIV() to add to a HTML page. and replacing "exec xx2
in env" with "restricted(xx2,env)" would do nearly the same thing.
and it returns a huge dictionary of many types, some excerpts are:
{...
...'globals': <built-in function globals>, ...
...'vars': <built-in function vars>, ...
...'locals': <built-in function locals>, ...
...'lucas53': <function lucas53 at 0x214348c>}
and i can see my executed function in there as a type function, and local
and global vars, but i can not access or find "harry" or "rtn" the
variables within the function lucas53. i do not know how to access the
local variables within lucas53 or the locals to find harry or rtn.
so i am still learning python. thanx for the help in advance. lucas
--