changeset 1597:c1c1d68d063e

pages (lists): uses std lib `json` and don't use anymore `DOMNODE`: those tricks are not needed anymore with recent versions of Brython.
author Goffi <goffi@goffi.org>
date Sun, 11 Feb 2024 21:32:53 +0100
parents 52098b5bab8d
children 86c7a3a625d5
files libervia/web/pages/calls/page_meta.py libervia/web/pages/lists/_browser/__init__.py
diffstat 2 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/web/pages/calls/page_meta.py	Wed Dec 13 22:06:05 2023 +0100
+++ b/libervia/web/pages/calls/page_meta.py	Sun Feb 11 21:32:53 2024 +0100
@@ -1,18 +1,6 @@
 #!/usr/bin/env python3
-
-
-from libervia.backend.core.i18n import _
-from libervia.backend.core.log import getLogger
-from libervia.backend.tools.common import data_format
-from twisted.internet import defer
-import datetime
-import time
-from dateutil import tz
-
 from libervia.web.server.constants import Const as C
 
-log = getLogger(__name__)
-
 
 name = "calls"
 access = C.PAGES_ACCESS_PROFILE
--- a/libervia/web/pages/lists/_browser/__init__.py	Wed Dec 13 22:06:05 2023 +0100
+++ b/libervia/web/pages/lists/_browser/__init__.py	Sun Feb 11 21:32:53 2024 +0100
@@ -1,6 +1,7 @@
-from browser import DOMNode, document, aio
-from javascript import JSON
+import json
+
 from bridge import AsyncBridge as Bridge, BridgeException
+from browser import document, aio
 import dialog
 
 bridge = Bridge()
@@ -10,9 +11,10 @@
     evt.stopPropagation()
     evt.preventDefault()
     target = evt.currentTarget
-    item_elt = DOMNode(target.closest('.item'))
+    item_elt = target.closest('.item')
     item_elt.classList.add("selected_for_deletion")
-    item = JSON.parse(item_elt.dataset.item)
+    item = json.loads(item_elt.dataset.item)
+
     confirmed = await dialog.Confirm(
         f"List {item['name']!r} will be deleted, are you sure?",
         ok_label="delete",