Thumbnail parent

Assetversion was not found when its not linked to a task. assetversion["task"] returns None instead of raising exception.
This commit is contained in:
Toke Stuart Jepsen 2020-08-26 11:06:49 +01:00
parent b20e653454
commit 76d65ca6d3

View file

@ -41,9 +41,9 @@ class ThumbToParent(BaseAction):
parent = None parent = None
thumbid = None thumbid = None
if entity.entity_type.lower() == 'assetversion': if entity.entity_type.lower() == 'assetversion':
try: parent = entity['task']
parent = entity['task']
except Exception: if parent is None:
par_ent = entity['link'][-2] par_ent = entity['link'][-2]
parent = session.get(par_ent['type'], par_ent['id']) parent = session.get(par_ent['type'], par_ent['id'])
else: else:
@ -51,7 +51,7 @@ class ThumbToParent(BaseAction):
parent = entity['parent'] parent = entity['parent']
except Exception as e: except Exception as e:
msg = ( msg = (
"Durin Action 'Thumb to Parent'" "During Action 'Thumb to Parent'"
" went something wrong" " went something wrong"
) )
self.log.error(msg) self.log.error(msg)
@ -62,7 +62,10 @@ class ThumbToParent(BaseAction):
parent['thumbnail_id'] = thumbid parent['thumbnail_id'] = thumbid
status = 'done' status = 'done'
else: else:
status = 'failed' raise Exception(
"Parent or thumbnail id not found. Parent: {}. "
"Thumbnail id: {}".format(parent, thumbid)
)
# inform the user that the job is done # inform the user that the job is done
job['status'] = status or 'done' job['status'] = status or 'done'