Short circuit the ancestry computation for empty ancestry strings.

This commit is contained in:
jakedt 2014-02-20 22:35:54 -05:00
parent a63a49caa1
commit f8eb0c983f

View file

@ -885,6 +885,9 @@ def create_repository(namespace, name, creating_user, visibility='private'):
def __translate_ancestry(old_ancestry, translations):
if old_ancestry == '/':
return '/'
old_ids = [int(id_str) for id_str in old_ancestry.split('/')[1:-1]]
new_ids = [str(translations[old_id]) for old_id in old_ids]
return '/%s/' % '/'.join(new_ids)