mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
multiple variants should not work as expected
This commit is contained in:
parent
2430410752
commit
0289546cde
1 changed files with 28 additions and 13 deletions
|
|
@ -23,7 +23,7 @@ class PypeCreatorMixin:
|
||||||
|
|
||||||
Mixin class must be used as first in inheritance order to override methods.
|
Mixin class must be used as first in inheritance order to override methods.
|
||||||
"""
|
"""
|
||||||
default_tempate = "{family}{user_input}"
|
default_tempate = "{family}{Variant}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_subset_name(
|
def get_subset_name(
|
||||||
|
|
@ -58,20 +58,35 @@ class PypeCreatorMixin:
|
||||||
|
|
||||||
# Simple check of task name existence for template with {task} in
|
# Simple check of task name existence for template with {task} in
|
||||||
# - missing task should be possible only in Standalone publisher
|
# - missing task should be possible only in Standalone publisher
|
||||||
if not task_name and "{task}" in template:
|
if not task_name and "{task" in template.lower():
|
||||||
raise TaskNotSetError()
|
raise TaskNotSetError()
|
||||||
|
|
||||||
fill_data = {
|
fill_pairs = (
|
||||||
"variant": variant,
|
("variant", variant),
|
||||||
"Variant": variant.capitalize(),
|
("family", family),
|
||||||
"VARIANT": variant.upper(),
|
("task", task_name)
|
||||||
"family": family,
|
)
|
||||||
"Family": family.capitalize(),
|
fill_data = {}
|
||||||
"FAMILY": family.upper(),
|
for key, value in fill_pairs:
|
||||||
"task": task_name,
|
# Handle cases when value is `None` (standalone publisher)
|
||||||
"Task": task_name.capitalize(),
|
if value is None:
|
||||||
"TASK": task_name.upper()
|
continue
|
||||||
}
|
# Keep value as it is
|
||||||
|
fill_data[key] = value
|
||||||
|
# Both key and value are with upper case
|
||||||
|
fill_data[key.upper()] = value.upper()
|
||||||
|
|
||||||
|
# Capitalize only first char of value
|
||||||
|
# - conditions are because of possible index errors
|
||||||
|
capitalized = ""
|
||||||
|
if value:
|
||||||
|
# Upper first character
|
||||||
|
capitalized += value[0].upper()
|
||||||
|
# Append rest of string if there is any
|
||||||
|
if len(value) > 1:
|
||||||
|
capitalized += value[1:]
|
||||||
|
fill_data[key.capitalize()] = capitalized
|
||||||
|
|
||||||
return template.format(**fill_data)
|
return template.format(**fill_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue