Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/journalentrybundle.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2008-11-28 18:42:57 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2008-11-28 18:42:57 (GMT)
commitb006cfdd12d5f22ccea35ab4f716350058cdf107 (patch)
tree5f633159b0d6dfdd3390da42a54576a4c7cb2ba2 /src/jarabe/journal/journalentrybundle.py
parent5ee998c245a05656b527eacb57cebe124a73dddf (diff)
First try at restoring removable devices support in the journal
Diffstat (limited to 'src/jarabe/journal/journalentrybundle.py')
-rw-r--r--src/jarabe/journal/journalentrybundle.py27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/jarabe/journal/journalentrybundle.py b/src/jarabe/journal/journalentrybundle.py
index b3efe92..5d4086c 100644
--- a/src/jarabe/journal/journalentrybundle.py
+++ b/src/jarabe/journal/journalentrybundle.py
@@ -19,11 +19,12 @@ import tempfile
import shutil
import cjson
-
import dbus
-from sugar.datastore import datastore
+
from sugar.bundle.bundle import Bundle, MalformedBundleException
+from jarabe.journal import model
+
class JournalEntryBundle(Bundle):
"""A Journal entry bundle
@@ -50,20 +51,14 @@ class JournalEntryBundle(Bundle):
self._unzip(install_dir)
try:
metadata = self._read_metadata(bundle_dir)
- jobject = datastore.create()
- try:
- for key, value in metadata.iteritems():
- jobject.metadata[key] = value
-
- preview = self._read_preview(uid, bundle_dir)
- if preview is not None:
- jobject.metadata['preview'] = dbus.ByteArray(preview)
-
- jobject.metadata['uid'] = ''
- jobject.file_path = os.path.join(bundle_dir, uid)
- datastore.write(jobject)
- finally:
- jobject.destroy()
+ metadata['uid'] = ''
+
+ preview = self._read_preview(uid, bundle_dir)
+ if preview is not None:
+ metadata['preview'] = dbus.ByteArray(preview)
+
+ file_path = os.path.join(bundle_dir, uid)
+ model.write(metadata, file_path)
finally:
shutil.rmtree(bundle_dir, ignore_errors=True)