changeset 1412:6fdef01f6671

browser (lists/view): Q&D fix for status change
author Goffi <goffi@goffi.org>
date Thu, 22 Apr 2021 21:37:50 +0200
parents 2c3bdba880bb
children 326730dc35da
files libervia/pages/lists/view/_browser/__init__.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/lists/view/_browser/__init__.py	Thu Apr 22 18:24:11 2021 +0200
+++ b/libervia/pages/lists/view/_browser/__init__.py	Thu Apr 22 21:37:50 2021 +0200
@@ -88,17 +88,16 @@
             f"Can't get item status: {e}",
             level="error"
         )
-        status = "to_buy"
-    if status == "to_buy":
-        item["status"] = "bought"
+        status = ["to_buy"]
+    if status == ["to_buy"]:
+        item["status"] = ["bought"]
         class_update_method = item_elt.classList.add
         checked = True
-    elif status == "bought":
-        item["status"] = "to_buy"
+    elif status == ["bought"]:
+        item["status"] = ["to_buy"]
         checked = False
         class_update_method = item_elt.classList.remove
     else:
-        print(status)
         dialog.notification.show(
             f"unexpected item status: {status!r}",
             level="error"
@@ -109,7 +108,8 @@
         await bridge.listSet(
             pubsub_service,
             pubsub_node,
-            {k: [v] for k,v in item.items()},
+            # FIXME: value type should be consistent, or we should serialise
+            {k: (v if isinstance(v, list) else [v]) for k,v in item.items()},
             "",
             item["id"],
             ""