diff --git a/data/model.py b/data/model.py index 04f34e6fc..97db86cc5 100644 --- a/data/model.py +++ b/data/model.py @@ -287,6 +287,9 @@ def get_parent_images(image_obj): parents = image_obj.ancestors parent_db_ids = parents.strip('/').split('/') + if parent_db_ids == ['']: + return [] + or_clauses = [(Image.id == db_id) for db_id in parent_db_ids] parent_images = Image.select().where(reduce(operator.or_, or_clauses)) id_to_image = {unicode(image.id): image for image in parent_images}