I can open an excel file and see its content
This commit is contained in:
@@ -25,7 +25,7 @@ class BaseCommand:
|
||||
:type description: str
|
||||
"""
|
||||
|
||||
def __init__(self, name, description):
|
||||
def __init__(self, name, description, auto_register=True):
|
||||
self.id = uuid.uuid4()
|
||||
self.name = name
|
||||
self.description = description
|
||||
@@ -34,7 +34,8 @@ class BaseCommand:
|
||||
self._ft = None
|
||||
|
||||
# register the command
|
||||
CommandsManager.register(self)
|
||||
if auto_register:
|
||||
CommandsManager.register(self)
|
||||
|
||||
def get_htmx_params(self):
|
||||
return {
|
||||
@@ -139,7 +140,7 @@ class Command(BaseCommand):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def _convert(self, key, value):
|
||||
def _cast_parameter(self, key, value):
|
||||
if key in self.callback_parameters:
|
||||
param = self.callback_parameters[key]
|
||||
if param.annotation == bool:
|
||||
@@ -174,7 +175,7 @@ class Command(BaseCommand):
|
||||
if client_response:
|
||||
for k, v in client_response.items():
|
||||
if k in self.callback_parameters:
|
||||
new_kwargs[k] = self._convert(k, v)
|
||||
new_kwargs[k] = self._cast_parameter(k, v)
|
||||
if 'client_response' in self.callback_parameters:
|
||||
new_kwargs['client_response'] = client_response
|
||||
|
||||
@@ -186,7 +187,9 @@ class Command(BaseCommand):
|
||||
# Set the hx-swap-oob attribute on all elements returned by the callback
|
||||
if isinstance(ret, (list, tuple)):
|
||||
for r in ret[1:]:
|
||||
if hasattr(r, 'attrs') and r.get("id", None) is not None:
|
||||
if (hasattr(r, 'attrs')
|
||||
and "hx-swap-oob" not in r.attrs
|
||||
and r.get("id", None) is not None):
|
||||
r.attrs["hx-swap-oob"] = r.attrs.get("hx-swap-oob", "true")
|
||||
|
||||
if not ret_from_bindings:
|
||||
|
||||
Reference in New Issue
Block a user