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

Simon Schampijer simon at schampijer.de
Fri Mar 23 07:38:39 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.

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 model.py       |    6 +++---
 webactivity.py |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/model.py b/model.py
index d3d26e4..5dce50c 100644
--- a/model.py
+++ b/model.py
@@ -16,7 +16,7 @@
 #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
-import cjson
+import json
 import sha
 from gi.repository import GObject
 import base64
@@ -59,10 +59,10 @@ class Model(GObject.GObject):
                 break
 
     def serialize(self):
-        return cjson.encode(self.data)
+        return json.dumps(self.data)
 
     def deserialize(self, data):
-        self.data = cjson.decode(data)
+        self.data = json.loads(data)
         self.data.setdefault('shared_links', [])
         self.data.setdefault('deleted', [])
 
diff --git a/webactivity.py b/webactivity.py
index 8b8db59..29258e6 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -33,7 +33,7 @@ import base64
 import time
 import shutil
 import sqlite3
-import cjson
+import json
 from gi.repository import GConf
 import locale
 import cairo
@@ -123,7 +123,7 @@ def _seed_xs_cookie():
                                               path, expiry, lastAccessed,
                                               isSecure, isHttpOnly)
                      VALUES(?,?,?,?,?,?,?,?)''',
-                  ('xoid', cjson.encode(cookie_data), jabber_server,
+                  ('xoid', json.loads(cookie_data), jabber_server,
                    '/', expire, 0, 0, 0))
         cookies_db.commit()
         cookies_db.close()
-- 
1.7.7.6



More information about the Sugar-devel mailing list