[Sugar-devel] [sugar] Gio.content_type_guess now returns a dict instead of a str
Simon Schampijer
simon at schampijer.de
Tue Sep 25 09:25:26 EDT 2012
Thanks!
Pushed with a slight modification in displaying all the returns:
http://git.sugarlabs.org/sugar/mainline/commit/bcb2da9259164402bbf2bbdfbe4f0cf3ef2279d2
On 09/21/2012 11:02 PM, godiard at sugarlabs.org wrote:
> 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',
>
More information about the Sugar-devel
mailing list