implemented get_representation_parents for single representation

This commit is contained in:
Jakub Trllo 2022-06-07 15:16:39 +02:00
parent 7109d932ec
commit 9829410932
2 changed files with 11 additions and 0 deletions

View file

@ -22,6 +22,7 @@ from .entities import (
get_representation,
get_representation_by_name,
get_representations,
get_representation_parents,
get_representations_parents,
get_thumbnail,
@ -52,6 +53,7 @@ __all__ = (
"get_representation",
"get_representation_by_name",
"get_representations",
"get_representation_parents",
"get_representations_parents",
"get_thubmnail",

View file

@ -641,6 +641,15 @@ def get_representations_parents(project_name, representations):
return output
def get_representation_parents(project_name, representation):
if not representation:
return None
repre_id = representation["_id"]
parents_by_repre_id = get_representations(project_name, [representation])
return parents_by_repre_id.get(repre_id)
def get_thumbnail_id_from_source(project_name, src_type, src_id):
if not src_type or not src_id:
return None