From 548774a91951e5ae83bd2717efa82eb87801647d Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Sun, 6 Sep 2009 07:32:49 +0000
Subject: Some activities relies on existing of ds fields like 'title' #1241
---
src/sugar/datastore/datastore.py | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
index 81cda9c..0ad42b6 100644
a
|
b
|
from datetime import datetime |
25 | 25 | import os |
26 | 26 | import tempfile |
27 | 27 | import gobject |
| 28 | import gconf |
| 29 | import gio |
28 | 30 | |
29 | 31 | from sugar import env |
30 | 32 | from sugar.datastore import dbus_helpers |
… |
… |
class DSObject(object): |
142 | 144 | class RawObject(object): |
143 | 145 | |
144 | 146 | def __init__(self, file_path): |
| 147 | stat = os.stat(file_path) |
| 148 | client = gconf.client_get_default() |
| 149 | metadata = { |
| 150 | 'uid': file_path, |
| 151 | 'title': os.path.basename(file_path), |
| 152 | 'timestamp': stat.st_mtime, |
| 153 | 'mime_type': gio.content_type_guess(filename=file_path), |
| 154 | 'activity': '', |
| 155 | 'activity_id': '', |
| 156 | 'icon-color': client.get_string('/desktop/sugar/user/color'), |
| 157 | 'description': file_path, |
| 158 | } |
| 159 | |
145 | 160 | self.object_id = file_path |
146 | | self._metadata = DSMetadata() |
| 161 | self._metadata = DSMetadata(metadata) |
147 | 162 | self._file_path = None |
148 | 163 | self._destroyed = False |
149 | 164 | |