mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Fixed key check towards kwargs
This commit is contained in:
parent
79eec64ba1
commit
b3816ae876
1 changed files with 4 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue