mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added get_project_from_entity to ftrack base event handler
This commit is contained in:
parent
4a3b98c945
commit
0b2c1fc99f
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