Add a helper method to Image to parse ancestor string.

This commit is contained in:
Jake Moshenko 2016-08-26 14:46:18 -04:00
parent cd8b45e25b
commit 1d8b72235a
6 changed files with 33 additions and 32 deletions

View file

@ -616,6 +616,12 @@ class Image(BaseModel):
(('security_indexed_engine', 'security_indexed'), False),
)
def ancestor_id_list(self):
""" Returns an integer list of ancestor ids, ordered chronologically from
root to direct parent.
"""
return map(int, self.ancestors.split('/')[1:-1])
_ImageProxy.initialize(Image)