You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm having an issue when using TemplateResponse. Apparently, the template is not being translated into a Lona node tree.
The error is not thrown right at the beginning but only when I click the button. However, my open_dialog method is not executed.
I get this tracestack:
MainThread ERROR 10:02:32.873117 aiohttp.server Error handling request
Traceback (most recent call last):
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\aiohttp\web_protocol.py", line 456, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\aiohttp\web_app.py", line 537, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\server.py", line 649, in _shielded_handle_http_request
return await asyncio.shield(self._handle_http_request(request))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\server.py", line 597, in _handle_http_request
return await self._handle_websocket_request(http_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\server.py", line 508, in _handle_websocket_request
await self._handle_websocket_message(connection, message)
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\server.py", line 453, in _handle_websocket_message
await self._middleware_controller.handle_websocket_message(
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\middleware_controller.py", line 206, in handle_websocket_message
return await self.server.run_function_async(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\server.py", line 711, in _function
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\middleware_controller.py", line 111, in _run_middlewares_sync
return_value = hook(data)
^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\middlewares\lona_messages.py", line 32, in handle_websocket_message
data.server._view_runtime_controller.handle_lona_message(
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\view_runtime_controller.py", line 321, in handle_lona_message
self.handle_input_event_message(
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\view_runtime_controller.py", line 121, in handle_input_event_message
view_runtime.handle_input_event(
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\view_runtime.py", line 715, in handle_input_event
input_event = InputEvent(
^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\events\input_event.py", line 64, in __init__
self.nodes = document.get_node(node_id=self.node_info[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Desktop\data\Workspace\python-lona-app\.venv\Lib\site-packages\lona\html\document.py", line 40, in get_node
if self.html.id == node_id:
^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'id'
Thank you for the explanation. OK, I’ll need to rethink my approach a bit. I thought it would be more efficient to create as few nodes as possible server-side as Python objects. My idea was to be able to adjust lists or tables more flexibly using templates.
Hi,
I'm having an issue when using TemplateResponse. Apparently, the template is not being translated into a Lona node tree.
The error is not thrown right at the beginning but only when I click the button. However, my open_dialog method is not executed.
I get this tracestack:
Here is my code:
views.py
:templates/base.html
:I use the picocss frontend template. When I just return all as HTML-Node then everything works fine.
When I modify the
document.py
like this, it seems to work correctly:document.py
:Best regards
The text was updated successfully, but these errors were encountered: