[Sugar-devel] [PATCH] Use json as included in Python SL #3142

Simon Schampijer simon at schampijer.de
Wed Aug 8 09:11:33 EDT 2012


We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance. The
same patch landed in toolkit-gtk3 already.

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/sugar/activity/activity.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index bfc7358..2cf347e 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -54,6 +54,7 @@ import os
 import time
 from hashlib import sha1
 from functools import partial
+import json
 
 import gconf
 import gtk
@@ -61,7 +62,6 @@ import gobject
 import dbus
 import dbus.service
 from dbus import PROPERTIES_IFACE
-import cjson
 from telepathy.server import DBusProperties
 from telepathy.interfaces import CHANNEL, \
                                  CHANNEL_TYPE_TEXT, \
@@ -677,8 +677,8 @@ class Activity(Window, gtk.Container):
 
         buddies_dict = self._get_buddies()
         if buddies_dict:
-            self.metadata['buddies_id'] = cjson.encode(buddies_dict.keys())
-            self.metadata['buddies'] = cjson.encode(self._get_buddies())
+            self.metadata['buddies_id'] = json.dumps(buddies_dict.keys())
+            self.metadata['buddies'] = json.dumps(self._get_buddies())
 
         preview = self.get_preview()
         if preview is not None:
-- 
1.7.11.2



More information about the Sugar-devel mailing list