diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-06-30 04:31:58 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-06-30 04:31:58 (GMT) |
commit | 261c7324995e808fb3d781b66ac18634c7e78f14 (patch) | |
tree | b82e2acf6de8ec8b41c295f6e5557beb2f50ef0b /TurtleArt/tautils.py | |
parent | c413529f53e333d1871825c9520cf79bb70484a2 (diff) | |
parent | ab4e5279bd1511c134bdcca83895edc8f6c33cb8 (diff) |
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r-- | TurtleArt/tautils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index 40c39e9..d60884e 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -235,8 +235,15 @@ def data_from_file(ta_file): def data_from_string(text): ''' JSON load data from a string. ''' - return json_load(text.replace(']],\n', ']], ')) - + if type(text) == str: + return json_load(text.replace(']],\n', ']], ')) + else: + print type(text), text + if hasattr('replace', text): + return json_load(text.replace(']],\n', ']], ')) + else: + print 'type error in data_from_string' + return '' def data_to_file(data, ta_file): ''' Write data to a file. ''' |