diff libervia/pages/lists/edit/page_meta.py @ 1387:a84383c659b4

lists: creation, invitation, item deletion: this big patch includes: - reorganisation of pages for consistency, discovery is now the main list page, and list overview is now in `view` while item view is moved to `view_item` - lists from lists of interest are now shown in discovery page - list deletion from discory page - list can now be created, using templates now available from backend - invitation manager can now be used from list overview - list item can now be deleted from `view_item`
author Goffi <goffi@goffi.org>
date Sat, 20 Feb 2021 14:07:22 +0100
parents e3e303a30a74
children b46fec21ceb9
line wrap: on
line diff
--- a/libervia/pages/lists/edit/page_meta.py	Sat Feb 20 13:58:42 2021 +0100
+++ b/libervia/pages/lists/edit/page_meta.py	Sat Feb 20 14:07:22 2021 +0100
@@ -16,24 +16,20 @@
 
 
 def parse_url(self, request):
-    try:
-        item_id = self.nextPath(request)
-    except IndexError:
+    self.getPathArgs(request, ["service", "node", "item_id"], service="jid", node="@")
+    data = self.getRData(request)
+    if data["item_id"] is None:
         log.warning(_("no list item id specified"))
         self.pageError(request, C.HTTP_BAD_REQUEST)
 
-    data = self.getRData(request)
-    data["list_item_id"] = item_id
-
-
 @defer.inlineCallbacks
 def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
-    service, node, list_item_id = (
+    service, node, item_id = (
         data.get("service", ""),
         data.get("node", ""),
-        data["list_item_id"],
+        data["item_id"],
     )
     profile = self.getProfile(request)
 
@@ -53,7 +49,7 @@
         service.full() if service else "",
         node,
         C.NO_LIMIT,
-        [list_item_id],
+        [item_id],
         "",
         {},
         profile,
@@ -87,7 +83,7 @@
     data = self.getRData(request)
     service = data["service"]
     node = data["node"]
-    list_item_id = data["list_item_id"]
+    item_id = data["item_id"]
     posted_data = self.getAllPostedData(request)
     if not posted_data["title"] or not posted_data["body"]:
         self.pageError(request, C.HTTP_BAD_REQUEST)
@@ -106,7 +102,7 @@
 
     extra = {'update': True}
     yield self.host.bridgeCall(
-        "listSet", service.full(), node, posted_data, "", list_item_id,
+        "listSet", service.full(), node, posted_data, "", item_id,
         data_format.serialise(extra), profile
     )
     # we don't want to redirect to edit page on success, but to list overview