[Sugar-devel] [PATCH] Don't crash on invalid favoriteslayout settings

James Cameron quozl at laptop.org
Wed May 5 03:46:49 EDT 2010


On Tue, May 04, 2010 at 07:22:36PM -0400, Bernie Innocenti wrote:
> This could happen if the user upgrades Sugar to a new version which
> doesn't support the old layout.
> 
> Signed-off-by: Bernie Innocenti <bernie at codewiz.org>

I figured out you're patching 0.84, 'cause the line numbers didn't match
unless I was looking at 0.84.  ;-)

While this is one fix, perhaps it would be better to pick the patch that
made it into later versions.  See bf2296f from 2009-09-16 (ticket #1147)
which changes FavoritesView._set_layout from this:

    def _set_layout(self, layout):
        if layout not in LAYOUT_MAP:
            raise ValueError('Unknown favorites layout: %r' % layout)

to this:

    def _set_layout(self, layout):
        if layout not in LAYOUT_MAP:
            logging.warn('Unknown favorites layout: %r' % layout)
            layout = favoriteslayout.RingLayout.key
            assert layout in LAYOUT_MAP

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list