Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-03-20 17:16:01 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-03-20 17:16:01 (GMT)
commitf0ab2c46c0fe3f26ce10d7a07e59fba2b612d166 (patch)
treeadbb38ec49ac0a5b155e4cdf336f98bdb909458b /utils.py
parentf84386784d4f447fb20b00bceb5f2f731e45c65b (diff)
first rough pass at collaboration
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/utils.py b/utils.py
index ae689d7..b382490 100644
--- a/utils.py
+++ b/utils.py
@@ -32,10 +32,7 @@ def json_load(text):
listdata = json.read(text)
else:
# strip out leading and trailing whitespace, nulls, and newlines
- clean_text = text.lstrip()
- clean_text = clean_text.replace('\12', '')
- clean_text = clean_text.replace('\00', '')
- io = StringIO(clean_text.rstrip())
+ io = StringIO(text)
try:
listdata = jload(io)
except ValueError:
@@ -45,6 +42,7 @@ def json_load(text):
listdata[i] = int(value)
return listdata
+
def json_dump(data):
""" Save data using available JSON tools. """
if OLD_SUGAR_SYSTEM is True:
@@ -53,12 +51,3 @@ def json_dump(data):
_io = StringIO()
jdump(data, _io)
return _io.getvalue()
-
-def data_from_string(text):
- """ JSON load data from a string. """
- return json_load(text.replace(']],\n', ']], '))
-
-def data_to_string(data):
- """ JSON dump a string. """
- return json_dump(data).replace(']], ', ']],\n')
-