Short circuit the ancestry computation for empty ancestry strings.
This commit is contained in:
parent
a63a49caa1
commit
f8eb0c983f
1 changed files with 3 additions and 0 deletions
|
@ -885,6 +885,9 @@ def create_repository(namespace, name, creating_user, visibility='private'):
|
||||||
|
|
||||||
|
|
||||||
def __translate_ancestry(old_ancestry, translations):
|
def __translate_ancestry(old_ancestry, translations):
|
||||||
|
if old_ancestry == '/':
|
||||||
|
return '/'
|
||||||
|
|
||||||
old_ids = [int(id_str) for id_str in old_ancestry.split('/')[1:-1]]
|
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]
|
new_ids = [str(translations[old_id]) for old_id in old_ids]
|
||||||
return '/%s/' % '/'.join(new_ids)
|
return '/%s/' % '/'.join(new_ids)
|
||||||
|
|
Reference in a new issue