From 2fbf01856a88a859fc6f09de8cb3e211f0ea0b22 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 1 Mar 2021 12:25:28 +0100 Subject: [PATCH] added simple check of task existence when template requires task name --- pype/plugin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pype/plugin.py b/pype/plugin.py index 05a8a68c16..2ae25dabed 100644 --- a/pype/plugin.py +++ b/pype/plugin.py @@ -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,