changeset 1359:2da573bf3f8b

server: new `menu_extra_json` configuration option: this option can be used tp extend the defaut menu without having to redefine it.
author Goffi <goffi@goffi.org>
date Mon, 28 Sep 2020 17:12:04 +0200
parents 3c5054a22e7a
children 389a83eefe62
files libervia/server/server.py twisted/plugins/libervia_server.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/server.py	Thu Sep 17 22:50:27 2020 +0200
+++ b/libervia/server/server.py	Mon Sep 28 17:12:04 2020 +0200
@@ -836,8 +836,12 @@
 
         self._moveFirstLevelToDict(self.options, "url_redirections_dict", sites_names)
         self._moveFirstLevelToDict(self.options, "menu_json", sites_names)
-        if not '' in self.options["menu_json"]:
-            self.options["menu_json"][''] = C.DEFAULT_MENU
+        self._moveFirstLevelToDict(self.options, "menu_extra_json", sites_names)
+        menu = self.options["menu_json"]
+        if not '' in menu:
+            menu[''] = C.DEFAULT_MENU
+        for site, value in self.options["menu_extra_json"].items():
+            menu[site].extend(value)
 
         # we create virtual hosts and import Libervia pages into them
         self.vhost_root = vhost.NameVirtualHost()
--- a/twisted/plugins/libervia_server.py	Thu Sep 17 22:50:27 2020 +0200
+++ b/twisted/plugins/libervia_server.py	Mon Sep 28 17:12:04 2020 +0200
@@ -138,6 +138,7 @@
     ["vhosts_dict", None, {}, None],
     ["url_redirections_dict", None, {}, None],
     ["menu_json", None, {'': C.DEFAULT_MENU}, None],
+    ["menu_extra_json", None, {}, None],
     ["tickets_trackers_json", None, None, None],
     ["mr_handlers_json", None, None, None],
 ]