From ecee40a5cf25466d483bda4b2f61177ca30973b5 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Thu, 9 Aug 2012 10:22:12 -0300
Subject: [PATCH Read] Use json as included in Python SL #3142
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: Manuel Kaufmann <humitos@gmail.com>
---
readbookmark.py | 6 +++---
readdialog.py | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/readbookmark.py b/readbookmark.py
index 6a8e96c..c0afe4f 100644
a
|
b
|
|
15 | 15 | # along with this program; if not, write to the Free Software |
16 | 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | 17 | |
18 | | import cjson |
| 18 | import json |
19 | 19 | |
20 | 20 | |
21 | 21 | class Bookmark: |
… |
… |
class Bookmark: |
39 | 39 | if self.content == '' or self.content is None: |
40 | 40 | return '' |
41 | 41 | |
42 | | note = cjson.decode(self.content) |
| 42 | note = json.loads(self.content) |
43 | 43 | return note['title'] |
44 | 44 | |
45 | 45 | def get_note_body(self): |
46 | 46 | if self.content == '' or self.content is None: |
47 | 47 | return '' |
48 | 48 | |
49 | | note = cjson.decode(self.content) |
| 49 | note = json.loads(self.content) |
50 | 50 | return note['body'] |
diff --git a/readdialog.py b/readdialog.py
index b6366bf..4c868d5 100644
a
|
b
|
from sugar3.graphics import style |
9 | 9 | from sugar3.graphics.toolbutton import ToolButton |
10 | 10 | |
11 | 11 | from gettext import gettext as _ |
12 | | import cjson |
| 12 | import json |
13 | 13 | |
14 | 14 | |
15 | 15 | class BaseReadDialog(Gtk.Window): |
… |
… |
class BookmarkAddDialog(BookmarkDialog): |
180 | 180 | content = {'title': title.decode('utf-8'), |
181 | 181 | 'body': details.decode('utf-8')} |
182 | 182 | self._sidebarinstance._real_add_bookmark(self._page, |
183 | | cjson.encode(content)) |
| 183 | json.dumps(content)) |
184 | 184 | self.destroy() |
185 | 185 | |
186 | 186 | def cancel_clicked_cb(self, widget): |
… |
… |
class BookmarkEditDialog(BookmarkDialog): |
202 | 202 | 'body': details.decode('utf-8')} |
203 | 203 | self._sidebarinstance.del_bookmark(self._page) |
204 | 204 | self._sidebarinstance._real_add_bookmark(self._page, |
205 | | cjson.encode(content)) |
| 205 | json.dumps(content)) |
206 | 206 | self.destroy() |