Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <silbe@activitycentral.com>2012-01-18 01:56:22 (GMT)
committer Anish Mangal <anish@activitycentral.com>2012-02-01 12:33:31 (GMT)
commitfac510face3a03d43b758e1c1fce0eece053279b (patch)
treef38234cce221035c428fcfb837c6423020d17e7f
parent07dad25b5df19f8c5a79351246c2cf65419dac98 (diff)
Journal detail view: don't choke on invalid 'keep' property (fixes SL#1591)
Properties of data store entries can get corrupted, e.g. due to low level crashes or running out of battery (see OLPC#11372 [1] for a real-life example). In addition any activity can - accidentally or on purpose - write data store entries with arbitrary metadata. By comparing the 'keep' property as a string we can avoid the ValueError that might happen when trying to convert the property value to an integer. [1] https://dev.laptop.org/ticket/11372 Reported-by: Gary Martin <garycmartin@googlemail.com> Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r--src/jarabe/journal/expandedentry.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 4e99dc2..03f8cd1 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -144,7 +144,7 @@ class ExpandedEntry(hippo.CanvasBox):
return
self._metadata = metadata
- self._keep_icon.keep = (int(metadata.get('keep', 0)) == 1)
+ self._keep_icon.keep = (str(metadata.get('keep', 0)) == '1')
self._icon = self._create_icon()
self._icon_box.clear()
@@ -419,7 +419,7 @@ class ExpandedEntry(hippo.CanvasBox):
self._update_title_sid = None
def get_keep(self):
- return int(self._metadata.get('keep', 0)) == 1
+ return (str(self._metadata.get('keep', 0)) == '1')
def _keep_icon_activated_cb(self, keep_icon):
if self.get_keep():