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
thumbid = None
if entity.entity_type.lower() == 'assetversion':
try:
parent = entity['task']
except Exception:
parent = entity['task']
if parent is None:
par_ent = entity['link'][-2]
parent = session.get(par_ent['type'], par_ent['id'])
else:
@ -51,7 +51,7 @@ class ThumbToParent(BaseAction):
parent = entity['parent']
except Exception as e:
msg = (
"Durin Action 'Thumb to Parent'"
"During Action 'Thumb to Parent'"
" went something wrong"
)
self.log.error(msg)
@ -62,7 +62,10 @@ class ThumbToParent(BaseAction):
parent['thumbnail_id'] = thumbid
status = 'done'
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
job['status'] = status or 'done'