From ac93b69183fcf71e6efa0dd70bf16369824adc45 Mon Sep 17 00:00:00 2001
From: Martin Langhoff <martin@laptop.org>
Date: Thu, 12 Nov 2009 14:06:10 +0000
Subject: [PATCH] journalentrybundle: Accept plain JSON in a Journal Entry Bundle
The metadata for the Journal Entry Bundle is expected to be valid
JSON. the CJSON parser is a lot more strict, and will parse incorrectly
valid metadata.
External systems -- such as Moodle -- create JEBs for Sugar and do not
have a CJSON implementation.
---
src/jarabe/journal/journalentrybundle.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/jarabe/journal/journalentrybundle.py b/src/jarabe/journal/journalentrybundle.py
index 3bc1430..f52233d 100644
a
|
b
|
import os |
18 | 18 | import tempfile |
19 | 19 | import shutil |
20 | 20 | |
21 | | import cjson |
| 21 | import json |
22 | 22 | import dbus |
23 | 23 | |
24 | 24 | from sugar.bundle.bundle import Bundle, MalformedBundleException |
… |
… |
class JournalEntryBundle(Bundle): |
65 | 65 | if not os.path.exists(metadata_path): |
66 | 66 | raise MalformedBundleException( |
67 | 67 | 'Bundle must contain the file "_metadata.json"') |
68 | | return cjson.decode(open(metadata_path, 'r').read()) |
| 68 | # use json instead of cjson -- some JEB producers |
| 69 | # can't/won't write cjson |
| 70 | return json.load(open(metadata_path, 'r')) |
69 | 71 | |
70 | 72 | def _read_preview(self, uid, bundle_dir): |
71 | 73 | preview_path = os.path.join(bundle_dir, 'preview', uid) |