added simple check of task existence when template requires task name

This commit is contained in:
iLLiCiTiT 2021-03-01 12:25:28 +01:00
parent ad3458c232
commit 2fbf01856a

View file

@ -11,6 +11,13 @@ ValidateSceneOrder = pyblish.api.ValidatorOrder + 0.2
ValidateMeshOrder = pyblish.api.ValidatorOrder + 0.3
class TaskNotSetError(KeyError):
def __init__(self, msg=None):
if not msg:
msg = "Creator's subset name template requires task name."
super(TaskNotSetError, self).__init__(msg)
class PypeCreatorMixin:
"""Helper to override avalon's default class methods.
@ -53,6 +60,11 @@ class PypeCreatorMixin:
if not template:
template = cls.default_tempate
# Simple check of task name existence for template with {task} in
# - missing task should be possible only in Standalone publisher
if not task_name and "{task}" in template:
raise TaskNotSetError()
fill_data = {
"user_input": user_text,
"userInput": user_text,