From bcb2da9259164402bbf2bbdfbe4f0cf3ef2279d2 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Fri, 21 Sep 2012 21:02:04 +0000 Subject: Gio.content_type_guess now returns a dict instead of a str This is a change in the api. The second element in the dict is the certainty [1]. 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 Acked-by: Simon Schampijer --- diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py index fb73db7..0a5b354 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, uncertain_result_ = \ + Gio.content_type_guess(filename=full_path, data=None) if mime_type not in self._mime_types: return @@ -436,11 +437,13 @@ def _get_file_metadata(path, stat, fetch_preview=True): metadata['filesize'] = stat.st_size return metadata + mime_type, uncertain_result_ = Gio.content_type_guess(filename=path, + data=None) return {'uid': path, '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': mime_type, 'activity': '', 'activity_id': '', 'icon-color': '#000000,#ffffff', -- cgit v0.9.1