Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document.py11
-rw-r--r--messenger.py11
2 files changed, 16 insertions, 6 deletions
diff --git a/document.py b/document.py
index 9273f2c..d3ba739 100644
--- a/document.py
+++ b/document.py
@@ -14,9 +14,14 @@
import os
import gtk
-import cjson
from zipfile import ZipFile
+try:
+ import json
+ json.dumps
+except (ImportError, AttributeError):
+ import simplejson as json
+
import theme
from sound import *
from ground import *
@@ -70,7 +75,7 @@ def save(filepath):
node['index'] = i
cfg['tape'].append(node)
- zip.writestr('MANIFEST', cjson.encode(cfg))
+ zip.writestr('MANIFEST', json.dumps(cfg))
zip.close()
import shutil
@@ -78,7 +83,7 @@ def save(filepath):
def load(filepath):
zip = ZipFile(filepath, 'r')
- cfg = cjson.decode(zip.read('MANIFEST'))
+ cfg = json.loads(zip.read('MANIFEST'))
def _load(node, restored_class, preinstalled_class):
if node['custom']:
diff --git a/messenger.py b/messenger.py
index 04773c1..e6e72f3 100644
--- a/messenger.py
+++ b/messenger.py
@@ -12,12 +12,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import cjson
import logging
import dbus
from dbus.gobject_service import ExportedGObject
from dbus.service import method, signal
+try:
+ import json
+ json.dumps
+except (ImportError, AttributeError):
+ import simplejson as json
+
from sugar.presence import presenceservice
import char
@@ -34,7 +39,7 @@ PATH = '/org/sugarlabs/CartoonBuilder'
class Slot:
def __init__(self, sender=None, raw=None):
if sender:
- data = cjson.decode(raw)
+ data = json.loads(raw)
self.seqno = data['seqno']
self.oid = data['oid']
self.sender = sender
@@ -44,7 +49,7 @@ class Slot:
self.sender = None
def serialize(self):
- return cjson.encode({
+ return json.dumps({
'seqno': self.seqno,
'oid' : self.oid})