From 9cbbc2b8ed4ce6a8c0a91f3fa89b4d92d451a781 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Wed, 2 Oct 2013 17:29:45 -0400 Subject: [PATCH] Fix image history with no parent. --- data/model.py | 3 +++ 1 file changed, 3 insertions(+) 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}