I can convert commands to the requested type
This commit is contained in:
@@ -176,7 +176,7 @@ class TabsManager(MultipleInstance):
|
|||||||
content = component
|
content = component
|
||||||
|
|
||||||
return Div(
|
return Div(
|
||||||
content if content else Div("No active tab", cls="mf-empty-content"),
|
content if content else Div("No Content", cls="mf-empty-content"),
|
||||||
cls="mf-tab-content",
|
cls="mf-tab-content",
|
||||||
id=f"{self._id}-content"
|
id=f"{self._id}-content"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -116,6 +116,19 @@ class Command(BaseCommand):
|
|||||||
self.args = args
|
self.args = args
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
def _convert(self, key, value):
|
||||||
|
if key in self.callback_parameters:
|
||||||
|
param = self.callback_parameters[key]
|
||||||
|
if param.annotation == bool:
|
||||||
|
return value == "true"
|
||||||
|
elif param.annotation == int:
|
||||||
|
return int(value)
|
||||||
|
elif param.annotation == float:
|
||||||
|
return float(value)
|
||||||
|
elif param.annotation == list:
|
||||||
|
return value.split(",")
|
||||||
|
return value
|
||||||
|
|
||||||
def execute(self, client_response: dict = None):
|
def execute(self, client_response: dict = None):
|
||||||
ret_from_bindings = []
|
ret_from_bindings = []
|
||||||
|
|
||||||
@@ -129,7 +142,7 @@ class Command(BaseCommand):
|
|||||||
if client_response:
|
if client_response:
|
||||||
for k, v in client_response.items():
|
for k, v in client_response.items():
|
||||||
if k in self.callback_parameters:
|
if k in self.callback_parameters:
|
||||||
new_kwargs[k] = v
|
new_kwargs[k] = self._convert(k, v)
|
||||||
if 'client_response' in self.callback_parameters:
|
if 'client_response' in self.callback_parameters:
|
||||||
new_kwargs['client_response'] = client_response
|
new_kwargs['client_response'] = client_response
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user