Skip to content

Commit ce10a93

Browse files
Jo-Byrjourdain
authored andcommitted
fix(proxy-list): Initialize empty proxy lists
1 parent 47d76e1 commit ce10a93

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

trame_simput/core/proxy.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,20 @@ def __init__(
9595
if _prop_name.startswith("_"):
9696
continue
9797

98+
_size = _prop_def.get("size", None)
99+
_positive_size = _size is not None and isinstance(_size, int) and _size > 0
98100
_init_def = _prop_def.get("initial", None)
101+
_is_proxy = _prop_def.get("type", None) == "proxy"
102+
_proxy_type = _prop_def.get("proxyType", None)
99103
if _prop_name in kwargs:
100104
self.set_property(_prop_name, kwargs[_prop_name])
101105
elif isinstance(_init_def, dict):
102106
logger.error("Don't know how to deal with domain yet: %s", _init_def)
107+
elif _positive_size and _is_proxy and _proxy_type is not None:
108+
_init_def = [
109+
self._proxy_manager.create(_proxy_type).id for _ in range(_size)
110+
]
111+
self.set_property(_prop_name, _init_def)
103112
else:
104113
self.set_property(_prop_name, _init_def)
105114

0 commit comments

Comments
 (0)