[Sugar-devel] [PATCH sugar] Journal detail view: don't choke on invalid 'keep' property
silbe at activitycentral.com
Tue Jan 17 15:51:59 EST 2012
Excerpts from Simon Schampijer's message of 2012-01-10 14:26:46 +0100:
> There is another place in the code where we retrieve the 'keep'
> property, I would suggest something like:
> @@ -419,7 +419,8 @@ class ExpandedEntry(hippo.CanvasBox):
> self._update_title_sid = None
> def get_keep(self):
> - return int(self._metadata.get('keep', 0)) == 1
> + # We can not rely on the keep metadata to be int, SL 1591
> + return str(self._metadata.get('keep', 0)) == '1'
Good catch. I didn't trigger this one because I didn't try marking a
corrupted entry as favourite. The breakage isn't as bad either; instead
of failing to show the details view, it just won't mark a corrupted
entry as favourite (might even be a good thing to do on purpose ;) ).
> Afaik, this patch is not needed to fix .
It doesn't break the entire Journal, but it's triggered by the same
corrupted data store. Referencing the real-world case gives useful
background; I don't claim to fix the cited ticket.
> I think it would be better to note  as tickets it fixes.
Interesting, so we even had a patch  to fix this already (though it
may have been incomplete). Added SL#1591  to the summary.
My patch doesn't fix SL#1561  as I haven't done an exhaustive search
of all metadata users. While it would be useful, I don't consider it
worth the enormous effort. A better approach would be to construct a
data store with various variants of bad data. That would be
automatically testable, rather than requiring a regular code audit.
>  https://dev.laptop.org/ticket/11372
>  http://bugs.sugarlabs.org/ticket/1591
>  http://bugs.sugarlabs.org/ticket/1561
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: not available
More information about the Sugar-devel