[Bugs] #3142 UNSP: Use JSON implementations in Python's standard library instead of cjson

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Fri Sep 30 09:23:08 EDT 2011


#3142: Use JSON implementations in Python's standard library instead of cjson
------------------------------------------+---------------------------------
    Reporter:  erikos                     |          Owner:  erikos                     
        Type:  defect                     |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  sugar                      |        Version:  Unspecified                
    Severity:  Unspecified                |       Keywords:                             
Distribution:  Unspecified                |   Status_field:  Unconfirmed                
------------------------------------------+---------------------------------
 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 at 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:
 }}}

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/3142>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list