diff options
author | Emiliano Pastorino <epastorino@plan.ceibal.edu.uy> | 2011-03-23 12:30:00 (GMT) |
---|---|---|
committer | Emiliano Pastorino <epastorino@plan.ceibal.edu.uy> | 2011-03-23 12:30:00 (GMT) |
commit | d7d10290da2811d80a7e7885ed8c70b7aa59a260 (patch) | |
tree | e76d0f1eae75b7ef06d7b73eb1af2f9b4f7b4ad8 /TurtleArt/tajail.py | |
parent | 8bfacef788c7a5f71db4e75c52b055a53769fc27 (diff) | |
parent | d4ca05eb702dd15adba170dc1f18a78fb00656d9 (diff) |
Diffstat (limited to 'TurtleArt/tajail.py')
-rw-r--r-- | TurtleArt/tajail.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/TurtleArt/tajail.py b/TurtleArt/tajail.py index c8cea7f..3fcf997 100644 --- a/TurtleArt/tajail.py +++ b/TurtleArt/tajail.py @@ -25,6 +25,7 @@ from math import * def myfunc(f, args): + ''' Run inline Python code ''' # check to make sure no import calls are made if len(args) == 1: myf = 'def f(x): return ' + f.replace('import', '') @@ -44,10 +45,15 @@ def myfunc(f, args): def myfunc_import(parent, f, x): + ''' Run Python code imported from Journal ''' + if 'def myblock(lc,' in f: + base_class = parent.tw.lc # pre-v107, we passed lc + else: + base_class = parent.tw # as of v107, we pass tw userdefined = {} try: exec f in globals(), userdefined - return userdefined['myblock'](parent.tw, x) + return userdefined['myblock'](base_class, x) except: traceback.print_exc() return None |