Ticket #3142 (closed defect: fixed)
Use JSON implementations in Python's standard library instead of cjson
| Reported by: | erikos | Owned by: | humitos |
|---|---|---|---|
| Priority: | Unspecified by Maintainer | Milestone: | 0.98 |
| Component: | sugar | Version: | Unspecified |
| Severity: | Unspecified | Keywords: | |
| Cc: | pbrobinson, sascha_silbe, humitos, godiard | Distribution/OS: | Unspecified |
| Bug Status: | Unconfirmed |
Description
The shell has already moved back to use the standard json implementation, toolkit and datastore should follow.
Here an evaluation that performance wise this might be ok: http://www.tablix.org/~avian/blog/archives/2011/07/a_case_for_cjson/
As well, here the revert commit with a bit of explanation:
commit cff9e43527ead20b088a9bfc6bbf12b0827debfd
Author: Daniel Drake <dsd@laptop.org>
Date: Wed Nov 18 12:17:47 2009 +0000
Revert "Move to cjson and drop pyjson and simplejson"
This reverts commit ee4535c98ae74347e7072909d49dcf8a5e16ca7b.
cjson has a big bug dealing with slashes, this is a significant
long-term bug and upstream has not been responsive other than
acknowledging it. This bug breaks journal entry bundles.
http://dev.sugarlabs.org/ticket/1553
Thanks to Martin Langhoff for identifying and researching this issue
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 94d90ed..4463cac 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 cjson
+import json
from sugar.graphics import style
from sugar.graphics.icon import CanvasIcon
@@ -303,7 +303,9 @@ class ExpandedEntry(hippo.CanvasBox):
if self._metadata.has_key('buddies') and \
self._metadata['buddies']:
- buddies = cjson.decode(self._metadata['buddies']).values()
+ # json cannot read unicode strings
+ buddies_str = self._metadata['buddies'].encode('utf8')
+ buddies = json.read(buddies_str).values()
vbox.append(BuddyList(buddies))
return vbox
else:
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

