mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
fix python 2 compatibility of setting schemas
This commit is contained in:
parent
1f8f0286fa
commit
c97b6cb39a
3 changed files with 10 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ from abc import abstractmethod
|
|||
from .base_entity import ItemEntity
|
||||
from .lib import (
|
||||
NOT_SET,
|
||||
STRING_TYPE,
|
||||
OverrideState
|
||||
)
|
||||
from .exceptions import (
|
||||
|
|
@ -421,7 +422,7 @@ class TextEntity(InputEntity):
|
|||
schema_types = ["text"]
|
||||
|
||||
def _item_initalization(self):
|
||||
self.valid_value_types = (str, )
|
||||
self.valid_value_types = (STRING_TYPE, )
|
||||
self.value_on_not_set = ""
|
||||
|
||||
# GUI attributes
|
||||
|
|
@ -438,7 +439,7 @@ class PathInput(InputEntity):
|
|||
self.valid_value_types = (list, )
|
||||
self.value_on_not_set = ["", ""]
|
||||
else:
|
||||
self.valid_value_types = (str, )
|
||||
self.valid_value_types = (STRING_TYPE, )
|
||||
self.value_on_not_set = ""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from .lib import (
|
||||
NOT_SET,
|
||||
STRING_TYPE,
|
||||
OverrideState
|
||||
)
|
||||
from .exceptions import (
|
||||
|
|
@ -56,7 +57,7 @@ class PathEntity(ItemEntity):
|
|||
|
||||
# Create child object
|
||||
if not self.multiplatform and not self.multipath:
|
||||
valid_value_types = (str, )
|
||||
valid_value_types = (STRING_TYPE, )
|
||||
item_schema = {
|
||||
"type": "path-input",
|
||||
"key": self.key,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ from .exceptions import (
|
|||
SchemaDuplicatedEnvGroupKeys
|
||||
)
|
||||
|
||||
try:
|
||||
STRING_TYPE = basestring
|
||||
except Exception:
|
||||
STRING_TYPE = str
|
||||
|
||||
WRAPPER_TYPES = ["form", "collapsible-wrap"]
|
||||
NOT_SET = type("NOT_SET", (), {"__bool__": lambda obj: False})()
|
||||
|
|
@ -55,7 +59,7 @@ def _fill_schema_template_data(
|
|||
value, template_data, required_keys, missing_keys
|
||||
)
|
||||
|
||||
elif isinstance(template, str):
|
||||
elif isinstance(template, STRING_TYPE):
|
||||
# TODO find much better way how to handle filling template data
|
||||
for replacement_string in template_key_pattern.findall(template):
|
||||
key = str(replacement_string[1:-1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue