mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
handle full value replacement in template
This commit is contained in:
parent
9cfd8af2bf
commit
d91f470848
1 changed files with 10 additions and 1 deletions
|
|
@ -497,6 +497,7 @@ class SchemasHub:
|
|||
.replace("{{", "__dbcb__")
|
||||
.replace("}}", "__decb__")
|
||||
)
|
||||
full_replacement = False
|
||||
for replacement_string in template_key_pattern.findall(template):
|
||||
key = str(replacement_string[1:-1])
|
||||
required_keys.add(key)
|
||||
|
|
@ -509,11 +510,19 @@ class SchemasHub:
|
|||
# Replace the value with value from templates data
|
||||
# - with this is possible to set value with different type
|
||||
template = value
|
||||
full_replacement = True
|
||||
else:
|
||||
# Only replace the key in string
|
||||
template = template.replace(replacement_string, value)
|
||||
|
||||
output = template.replace("__dbcb__", "{").replace("__decb__", "}")
|
||||
if not full_replacement:
|
||||
output = (
|
||||
template
|
||||
.replace("__dbcb__", "{")
|
||||
.replace("__decb__", "}")
|
||||
)
|
||||
else:
|
||||
output = template
|
||||
|
||||
else:
|
||||
output = template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue