From cc6bab33b93dcacd95452cb457e10633b508863a Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Thu, 15 Sep 2011 13:43:24 +0200 Subject: [PATCH] only read annotations from children that support it (fixes #55) --- sloth/annotations/model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 40acb9d..2d271fe 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -278,7 +278,8 @@ class RootModelItem(ModelItem): return count def getAnnotations(self): - return [child.getAnnotations() for child in self.children()] + return [child.getAnnotations() for child in self.children() + if hasattr(child, 'getAnnotations')] class KeyValueModelItem(ModelItem, MutableMapping): def __init__(self, hidden=[], properties=None): @@ -449,7 +450,8 @@ class ImageFileModelItem(FileModelItem, ImageModelItem): def getAnnotations(self): self._ensureAllLoaded() fi = KeyValueModelItem.getAnnotations(self) - fi['annotations'] = [child.getAnnotations() for child in self.children()] + fi['annotations'] = [child.getAnnotations() for child in self.children() + if hasattr(child, 'getAnnotations')] return fi class VideoFileModelItem(FileModelItem):