[sugar] [PATCH] Merge activities.default into favorites.

Tomeu Vizoso tomeu
Mon May 19 09:19:04 EDT 2008


On Mon, May 19, 2008 at 2:54 PM, Simon Schampijer <simon at schampijer.de> wrote:
> Hi,
>
> following small note to the patch:
>
> what about using an else clause in the _load_favorites() method? So we know
> which ValueError the except block is trying to catch.
>
> try:
>    favorites_data = simplejson.load(open(favorites_path))
> except ValueError, e:
>    logging.error('Error while loading favorite_activities: %r.' %
>                   e)
> else:
>    # Old structure was a list instead of a dictionary.
>    if isinstance(favorites_data, list):
>        favorite_bundles = favorites_data
>    else:
>        favorite_bundles = favorites_data['favorites']
>        self._last_defaults_mtime = favorites_data['defaults-mtime']
>
>
> But r+ in general.

I like that, thanks!

Tomeu



More information about the Sugar-devel mailing list