[Sugar-devel] [sugar] Gio.content_type_guess now returns a dict instead of a str

godiard at sugarlabs.org godiard at sugarlabs.org
Fri Sep 21 17:02:04 EDT 2012


From: Gonzalo Odiard <godiard at gmail.com>

This is a change in the api. The second element in the dict
is the certainly [1]. We only need the first element.
Errors connected with this change can be seen when trying to access
the Documents folder in the Journal.

[1] http://developer.gnome.org/gio/stable/gio-GContentType.html#g-content-type-guess

Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
 src/jarabe/journal/model.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index fb73db7..53e11f0 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -394,7 +394,8 @@ class InplaceResultSet(BaseResultSet):
             return
 
         if self._mime_types:
-            mime_type = Gio.content_type_guess(filename=full_path, data=None)
+            mime_type = \
+                    Gio.content_type_guess(filename=full_path, data=None)[0]
             if mime_type not in self._mime_types:
                 return
 
@@ -440,7 +441,7 @@ def _get_file_metadata(path, stat, fetch_preview=True):
             'title': os.path.basename(path),
             'timestamp': stat.st_mtime,
             'filesize': stat.st_size,
-            'mime_type': Gio.content_type_guess(filename=path, data=None),
+            'mime_type': Gio.content_type_guess(filename=path, data=None)[0],
             'activity': '',
             'activity_id': '',
             'icon-color': '#000000,#ffffff',
-- 
1.7.11.4



More information about the Sugar-devel mailing list