Fix image history with no parent.

This commit is contained in:
yackob03 2013-10-02 17:29:45 -04:00
parent e90f9b37d4
commit 9cbbc2b8ed

View file

@ -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}