mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
added get project from entity to base handler
This commit is contained in:
parent
3c0f5f5baa
commit
2fc6aafecf
1 changed files with 16 additions and 0 deletions
|
|
@ -623,3 +623,19 @@ class BaseHandler(object):
|
|||
self.log.debug((
|
||||
"Publishing event: {}"
|
||||
).format(str(event.__dict__)))
|
||||
|
||||
def get_project_from_entity(self, entity):
|
||||
low_entity_type = entity.entity_type.lower()
|
||||
if low_entity_type == "project":
|
||||
return entity
|
||||
|
||||
if low_entity_type == "reviewsession":
|
||||
return entity["project"]
|
||||
|
||||
if low_entity_type == "filecomponent":
|
||||
entity = entity["version"]
|
||||
|
||||
project_data = entity["link"][0]
|
||||
return self.session.query(
|
||||
"Project where id is {}".format(project_data["id"])
|
||||
).one()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue