From c98d704a85f4691e478d50053036beb5f1411149 Mon Sep 17 00:00:00 2001 From: Martin Turoci Date: Wed, 18 Jan 2023 13:13:56 +0100 Subject: [PATCH] fix: Make the wavelite work for args, events and UI rendering. #1796 --- py/h2o_wavelite/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/py/h2o_wavelite/core.py b/py/h2o_wavelite/core.py index b924ec5dcc..7c8f9c7c5c 100644 --- a/py/h2o_wavelite/core.py +++ b/py/h2o_wavelite/core.py @@ -338,7 +338,8 @@ class PageBase: url: The URL of the remote page. """ - def __init__(self): + def __init__(self, url: str): + self.url = url self._changes = [] def add(self, key: str, card: Any) -> Ref: @@ -419,9 +420,9 @@ class AsyncPage(PageBase): url: The URL of this page. """ - def __init__(self, site: 'AsyncSite'): + def __init__(self, site: 'AsyncSite', url: str): self.site = site - super().__init__() + super().__init__(url) async def save(self): """ @@ -441,6 +442,9 @@ class AsyncSite: def __init__(self, send: Optional[Callable] = None): self.send = send + def __getitem__(self, url) -> AsyncPage: + return AsyncPage(self, url) + def __delitem__(self, key: str): page = self[key] page.drop()