From 10da5885cd8611354f0c903622a33124dcda4ac4 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Thu, 9 Mar 2023 21:13:42 +0100 Subject: [PATCH 01/17] Get the settings up and running --- .../defaults/project_settings/kitsu.json | 6 ++++- .../projects_schema/schema_project_kitsu.json | 26 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/openpype/settings/defaults/project_settings/kitsu.json b/openpype/settings/defaults/project_settings/kitsu.json index 95b3da04ae..280895f1b9 100644 --- a/openpype/settings/defaults/project_settings/kitsu.json +++ b/openpype/settings/defaults/project_settings/kitsu.json @@ -8,6 +8,10 @@ "IntegrateKitsuNote": { "set_status_note": false, "note_status_shortname": "wfa" + }, + "CustomCommentTemplate": { + "enabled": false, + "comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |" } } -} +} \ No newline at end of file diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json index fb47670e74..255190c396 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json @@ -54,8 +54,32 @@ "label": "Note shortname" } ] + }, + { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "key": "CustomCommentTemplate", + "label": "Custom Comment Template", + "children": [ + { + "type": "boolean", + "key": "enabled", + "label": "Enabled" + }, + { + "type": "label", + "label": "Kitsu supports markdown and here you can create a custom comment template.
You can use data from your instance's anatomy." + }, + { + "key": "comment_template", + "type": "text", + "multiline": true, + "label": "Custom comment" + } + ] } ] } ] -} +} \ No newline at end of file From e2771abfb48d255288a708407b305241f4601737 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 10 Mar 2023 23:07:13 +0100 Subject: [PATCH 02/17] Move CustomCommentTemplate to within IntegrateKitsuNote --- .../defaults/project_settings/kitsu.json | 10 ++--- .../projects_schema/schema_project_kitsu.json | 44 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/openpype/settings/defaults/project_settings/kitsu.json b/openpype/settings/defaults/project_settings/kitsu.json index 280895f1b9..f8a98d1a0b 100644 --- a/openpype/settings/defaults/project_settings/kitsu.json +++ b/openpype/settings/defaults/project_settings/kitsu.json @@ -7,11 +7,11 @@ "publish": { "IntegrateKitsuNote": { "set_status_note": false, - "note_status_shortname": "wfa" - }, - "CustomCommentTemplate": { - "enabled": false, - "comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |" + "note_status_shortname": "wfa", + "CustomCommentTemplate": { + "enabled": false, + "comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |" + } } } } \ No newline at end of file diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json index 255190c396..25f75c8280 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json @@ -52,30 +52,30 @@ "type": "text", "key": "note_status_shortname", "label": "Note shortname" - } - ] - }, - { - "type": "dict", - "collapsible": true, - "checkbox_key": "enabled", - "key": "CustomCommentTemplate", - "label": "Custom Comment Template", - "children": [ - { - "type": "boolean", - "key": "enabled", - "label": "Enabled" }, { - "type": "label", - "label": "Kitsu supports markdown and here you can create a custom comment template.
You can use data from your instance's anatomy." - }, - { - "key": "comment_template", - "type": "text", - "multiline": true, - "label": "Custom comment" + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "key": "CustomCommentTemplate", + "label": "Custom Comment Template", + "children": [ + { + "type": "boolean", + "key": "enabled", + "label": "Enabled" + }, + { + "type": "label", + "label": "Kitsu supports markdown and here you can create a custom comment template.
You can use data from your instance's anatomy." + }, + { + "key": "comment_template", + "type": "text", + "multiline": true, + "label": "Custom comment" + } + ] } ] } From 7c1789faabea2380ab3001e32876d2747cf55f28 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 10 Mar 2023 23:07:41 +0100 Subject: [PATCH 03/17] Add custom message functionally --- .../plugins/publish/integrate_kitsu_note.py | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 6702cbe7aa..b1743ca828 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import gazu import pyblish.api +import re class IntegrateKitsuNote(pyblish.api.ContextPlugin): @@ -9,17 +10,39 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): order = pyblish.api.IntegratorOrder label = "Kitsu Note and Status" families = ["render", "kitsu"] + + # status settings set_status_note = False note_status_shortname = "wfa" + # comment settings + CustomCommentTemplate = {} + CustomCommentTemplate["enabled"] = False + CustomCommentTemplate["comment_template"] = "{comment}" + + def safe_format(self, msg, **kwargs): + def replace_missing(match): + value = kwargs.get(match.group(1), None) + if value is None: + self.log.warning( + "Key `{}` was not found in instance.data " + "and will be rendered as `` in the comment".format( + match.group(1) + ) + ) + return "" + else: + return str(value) + + pattern = r"\{([^}]*)\}" + return re.sub(pattern, replace_missing, msg) + def process(self, context): # Get comment text body publish_comment = context.data.get("comment") if not publish_comment: self.log.info("Comment is not set.") - self.log.debug("Comment is `{}`".format(publish_comment)) - for instance in context: kitsu_task = instance.data.get("kitsu_task") if kitsu_task is None: @@ -42,6 +65,15 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): "changed!".format(self.note_status_shortname) ) + # If custom comment, create it + if self.CustomCommentTemplate["enabled"]: + publish_comment = self.safe_format( + self.CustomCommentTemplate["comment_template"], + **instance.data, + ) + + self.log.debug("Comment is `{}`".format(publish_comment)) + # Add comment to kitsu task task_id = kitsu_task["id"] self.log.debug("Add new note in taks id {}".format(task_id)) From a797d78d451eb953bd5c4a2018712ade3e645c2a Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 10 Mar 2023 23:19:31 +0100 Subject: [PATCH 04/17] Added a check so only renders gets published to Kitsu --- .../modules/kitsu/plugins/publish/integrate_kitsu_note.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index b1743ca828..44134dec6d 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -44,6 +44,10 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): self.log.info("Comment is not set.") for instance in context: + # Check if instance is a render by checking its family + if "render" not in instance.data["family"]: + continue + kitsu_task = instance.data.get("kitsu_task") if kitsu_task is None: continue From 1093c519add9baae3276e01aa28e1a1d46cab0c8 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 10 Mar 2023 23:27:47 +0100 Subject: [PATCH 05/17] Change the label to explain more correct what it does --- .../schemas/projects_schema/schema_project_kitsu.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json index 25f75c8280..1a7747b3dc 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json @@ -46,12 +46,12 @@ { "type": "boolean", "key": "set_status_note", - "label": "Set status on note" + "label": "Set status with note" }, { "type": "text", "key": "note_status_shortname", - "label": "Note shortname" + "label": "Status shortname" }, { "type": "dict", From 383ce7ccb6f20453ef2aa40d81b2af4ae5856eba Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Tue, 14 Mar 2023 18:32:18 +0100 Subject: [PATCH 06/17] Change variable name to snake_case --- .../kitsu/plugins/publish/integrate_kitsu_note.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 44134dec6d..debbfdf98e 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -16,9 +16,11 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): note_status_shortname = "wfa" # comment settings - CustomCommentTemplate = {} - CustomCommentTemplate["enabled"] = False - CustomCommentTemplate["comment_template"] = "{comment}" + custom_comment_template = {} + custom_comment_template = { + "enabled": False, + "comment_template": "{comment}", + } def safe_format(self, msg, **kwargs): def replace_missing(match): @@ -70,9 +72,9 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): ) # If custom comment, create it - if self.CustomCommentTemplate["enabled"]: + if self.custom_comment_template["enabled"]: publish_comment = self.safe_format( - self.CustomCommentTemplate["comment_template"], + self.custom_comment_template["comment_template"], **instance.data, ) From c53e5b2302b9916360bf3e3a2f38e550596f64d8 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Tue, 14 Mar 2023 18:32:41 +0100 Subject: [PATCH 07/17] Added docstring --- openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index debbfdf98e..a4b229d236 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -23,6 +23,8 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): } def safe_format(self, msg, **kwargs): + """If key is not found in kwargs, set None instead""" + def replace_missing(match): value = kwargs.get(match.group(1), None) if value is None: From a789b135aed5d1dabdbee3b3ae14904a95b34428 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Tue, 14 Mar 2023 18:33:00 +0100 Subject: [PATCH 08/17] Changed the instance check from render to review --- .../modules/kitsu/plugins/publish/integrate_kitsu_note.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index a4b229d236..2e1e656cee 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -48,8 +48,8 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): self.log.info("Comment is not set.") for instance in context: - # Check if instance is a render by checking its family - if "render" not in instance.data["family"]: + # Check if instance is a review by checking its family + if "review" not in instance.data["family"]: continue kitsu_task = instance.data.get("kitsu_task") From b3816ae876ff35d6187e43357d2580e46bafe2ae Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Wed, 15 Mar 2023 17:05:00 +0100 Subject: [PATCH 09/17] Fixed key check towards kwargs --- .../kitsu/plugins/publish/integrate_kitsu_note.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 2e1e656cee..d4282ab048 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -16,7 +16,6 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): note_status_shortname = "wfa" # comment settings - custom_comment_template = {} custom_comment_template = { "enabled": False, "comment_template": "{comment}", @@ -26,17 +25,15 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): """If key is not found in kwargs, set None instead""" def replace_missing(match): - value = kwargs.get(match.group(1), None) - if value is None: + key = match.group(1) + if key not in kwargs: self.log.warning( "Key `{}` was not found in instance.data " - "and will be rendered as `` in the comment".format( - match.group(1) - ) + "and will be rendered as `` in the comment".format(key) ) return "" else: - return str(value) + return str(kwargs[key]) pattern = r"\{([^}]*)\}" return re.sub(pattern, replace_missing, msg) From a30887bb746ebba4756329cefb36eb4fa77d0db7 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Wed, 15 Mar 2023 17:05:34 +0100 Subject: [PATCH 10/17] Change name from CamelCase to snake_case --- openpype/settings/defaults/project_settings/kitsu.json | 2 +- .../schemas/projects_schema/schema_project_kitsu.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openpype/settings/defaults/project_settings/kitsu.json b/openpype/settings/defaults/project_settings/kitsu.json index f8a98d1a0b..738bd95e38 100644 --- a/openpype/settings/defaults/project_settings/kitsu.json +++ b/openpype/settings/defaults/project_settings/kitsu.json @@ -8,7 +8,7 @@ "IntegrateKitsuNote": { "set_status_note": false, "note_status_shortname": "wfa", - "CustomCommentTemplate": { + "custom_comment_template": { "enabled": false, "comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |" } diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json index 1a7747b3dc..fc421c20f5 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json @@ -57,7 +57,7 @@ "type": "dict", "collapsible": true, "checkbox_key": "enabled", - "key": "CustomCommentTemplate", + "key": "custom_comment_template", "label": "Custom Comment Template", "children": [ { @@ -67,7 +67,7 @@ }, { "type": "label", - "label": "Kitsu supports markdown and here you can create a custom comment template.
You can use data from your instance's anatomy." + "label": "Kitsu supports markdown and here you can create a custom comment template.
You can use data from your publishing instance's data." }, { "key": "comment_template", From ce22b665b4b1ce1216f84156c09074cb6436545a Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Thu, 16 Mar 2023 10:39:47 +0100 Subject: [PATCH 11/17] Fixed comments in code --- .../kitsu/plugins/publish/integrate_kitsu_note.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index d4282ab048..69b456426f 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -22,21 +22,24 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): } def safe_format(self, msg, **kwargs): - """If key is not found in kwargs, set None instead""" + """Pars the msg thourgh a custom format code. + It makes sure non existing keys gets None returned instead of error + """ - def replace_missing(match): + def replace_missing_key(match): + """If key is not found in kwargs, set None instead""" key = match.group(1) if key not in kwargs: self.log.warning( - "Key `{}` was not found in instance.data " - "and will be rendered as `` in the comment".format(key) + "Key '{}' was not found in instance.data " + "and will be rendered as '' in the comment".format(key) ) return "" else: return str(kwargs[key]) pattern = r"\{([^}]*)\}" - return re.sub(pattern, replace_missing, msg) + return re.sub(pattern, replace_missing_key, msg) def process(self, context): # Get comment text body From adc648616f2eebe7780a81de5882bf95e805ddf9 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Thu, 16 Mar 2023 10:40:03 +0100 Subject: [PATCH 12/17] Look for review in families instead of family --- openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 69b456426f..3ad53a1f12 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -49,7 +49,7 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): for instance in context: # Check if instance is a review by checking its family - if "review" not in instance.data["family"]: + if "review" not in instance.data["families"]: continue kitsu_task = instance.data.get("kitsu_task") From f70eac116d1978a337c8adc912413ab5a12bd842 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Thu, 16 Mar 2023 17:11:16 +0100 Subject: [PATCH 13/17] Made the format function more logical --- .../plugins/publish/integrate_kitsu_note.py | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 3ad53a1f12..b0063282d0 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -21,25 +21,27 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): "comment_template": "{comment}", } - def safe_format(self, msg, **kwargs): - """Pars the msg thourgh a custom format code. - It makes sure non existing keys gets None returned instead of error - """ + def format_publish_comment(self, instance): + """Format the instance's publish comment + Formats `instance.data` against the custom template. + """ + def replace_missing_key(match): """If key is not found in kwargs, set None instead""" key = match.group(1) - if key not in kwargs: + if key not in instance.data: self.log.warning( - "Key '{}' was not found in instance.data " - "and will be rendered as '' in the comment".format(key) + "Key "{}" was not found in instance.data " + "and will be rendered as "" in the comment".format(key) ) return "" else: - return str(kwargs[key]) + return str(instance.data[key]) + template = self.custom_comment_template["comment_template"] pattern = r"\{([^}]*)\}" - return re.sub(pattern, replace_missing_key, msg) + return re.sub(pattern, replace_missing_key, template) def process(self, context): # Get comment text body @@ -75,10 +77,7 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): # If custom comment, create it if self.custom_comment_template["enabled"]: - publish_comment = self.safe_format( - self.custom_comment_template["comment_template"], - **instance.data, - ) + publish_comment = self.format_publish_comment(instance) self.log.debug("Comment is `{}`".format(publish_comment)) From 5a7bf785f72d4dacbf9283ee362f447991db2de8 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Thu, 16 Mar 2023 17:13:17 +0100 Subject: [PATCH 14/17] Fixed hound comments --- .../modules/kitsu/plugins/publish/integrate_kitsu_note.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index b0063282d0..a5a58c8462 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -26,14 +26,15 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): Formats `instance.data` against the custom template. """ - + def replace_missing_key(match): """If key is not found in kwargs, set None instead""" key = match.group(1) if key not in instance.data: self.log.warning( - "Key "{}" was not found in instance.data " - "and will be rendered as "" in the comment".format(key) + "Key '{}' was not found in instance.data " + "and will be rendered as " + " in the comment".format(key) ) return "" else: From c86e8e1d6ea0ae292fe414d5c499451884b230e1 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 17 Mar 2023 16:22:01 +0100 Subject: [PATCH 15/17] Added empty line in the end VSC removed it automatically before. --- openpype/settings/defaults/project_settings/kitsu.json | 2 +- .../entities/schemas/projects_schema/schema_project_kitsu.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/settings/defaults/project_settings/kitsu.json b/openpype/settings/defaults/project_settings/kitsu.json index 738bd95e38..11c138e8e5 100644 --- a/openpype/settings/defaults/project_settings/kitsu.json +++ b/openpype/settings/defaults/project_settings/kitsu.json @@ -14,4 +14,4 @@ } } } -} \ No newline at end of file +} diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json index fc421c20f5..7ceb979d6f 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_kitsu.json @@ -82,4 +82,4 @@ ] } ] -} \ No newline at end of file +} From 8a91e4aaa07dc10ae0d0c373749af103e284e5a7 Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 17 Mar 2023 16:22:28 +0100 Subject: [PATCH 16/17] Fixed comment --- .../modules/kitsu/plugins/publish/integrate_kitsu_note.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index a5a58c8462..67702578c5 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -33,8 +33,8 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): if key not in instance.data: self.log.warning( "Key '{}' was not found in instance.data " - "and will be rendered as " - " in the comment".format(key) + "and will be rendered as an empty string " + "in the comment".format(key) ) return "" else: From 94ba8151e72b6d069d8a72fb74477a6ad0f7739c Mon Sep 17 00:00:00 2001 From: Jacob Danell Date: Fri, 17 Mar 2023 16:23:13 +0100 Subject: [PATCH 17/17] Read the comment from the instance instead from the context --- .../kitsu/plugins/publish/integrate_kitsu_note.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py index 67702578c5..cf36bbc4fe 100644 --- a/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py +++ b/openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py @@ -45,11 +45,6 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): return re.sub(pattern, replace_missing_key, template) def process(self, context): - # Get comment text body - publish_comment = context.data.get("comment") - if not publish_comment: - self.log.info("Comment is not set.") - for instance in context: # Check if instance is a review by checking its family if "review" not in instance.data["families"]: @@ -76,11 +71,15 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin): "changed!".format(self.note_status_shortname) ) - # If custom comment, create it + # Get comment text body + publish_comment = instance.data.get("comment") if self.custom_comment_template["enabled"]: publish_comment = self.format_publish_comment(instance) - self.log.debug("Comment is `{}`".format(publish_comment)) + if not publish_comment: + self.log.info("Comment is not set.") + else: + self.log.debug("Comment is `{}`".format(publish_comment)) # Add comment to kitsu task task_id = kitsu_task["id"]