From bd3fdd73a853d618aa5000ff5b1ce82f196c8b70 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Mon, 23 Nov 2009 12:36:33 +0000 Subject: Switch entirely to simplejson I misunderstood the state of affairs with the numerous json parsers. Whatever we used to have as 'json' isn't really available on Py2.6. Move to simplejson which seems to be the most functional implementation, available on both old and new setups. --- (limited to 'src/jarabe') diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 4463cac..e73b717 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -23,7 +23,7 @@ import hippo import cairo import gobject import gtk -import json +import simplejson from sugar.graphics import style from sugar.graphics.icon import CanvasIcon @@ -303,9 +303,7 @@ class ExpandedEntry(hippo.CanvasBox): if self._metadata.has_key('buddies') and \ self._metadata['buddies']: - # json cannot read unicode strings - buddies_str = self._metadata['buddies'].encode('utf8') - buddies = json.read(buddies_str).values() + buddies = simplejson.loads(self._metadata['buddies']).values() vbox.append(BuddyList(buddies)) return vbox else: diff --git a/src/jarabe/journal/journalentrybundle.py b/src/jarabe/journal/journalentrybundle.py index a0bc935..74b2ac5 100644 --- a/src/jarabe/journal/journalentrybundle.py +++ b/src/jarabe/journal/journalentrybundle.py @@ -18,7 +18,7 @@ import os import tempfile import shutil -import json +import simplejson import dbus from sugar.bundle.bundle import Bundle, MalformedBundleException @@ -75,7 +75,7 @@ class JournalEntryBundle(Bundle): json_data = f.read() finally: f.close() - return json.read(json_data) + return simplejson.loads(json_data) def _read_preview(self, uid, bundle_dir): preview_path = os.path.join(bundle_dir, 'preview', uid) diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py index bc53a9c..d3b7e24 100644 --- a/src/jarabe/journal/listmodel.py +++ b/src/jarabe/journal/listmodel.py @@ -16,7 +16,7 @@ import logging -import json +import simplejson import gobject import gtk @@ -144,9 +144,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource): self._cached_row.append(int(metadata.get('progress', 100))) if metadata.get('buddies', ''): - # json cannot read unicode strings - buddies_str = metadata['buddies'].encode('utf8') - buddies = json.read(buddies_str).values() + buddies = simplejson.loads(metadata['buddies']).values() else: buddies = [] -- cgit v0.9.1