comparison libervia/server/server.py @ 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 4751e9febbbf
children 389a83eefe62
comparison
equal deleted inserted replaced
1358:3c5054a22e7a 1359:2da573bf3f8b
834 sites_names = list(self.renderer.sites_paths.keys()) 834 sites_names = list(self.renderer.sites_paths.keys())
835 self.restricted_bridge = RestrictedBridge(self) 835 self.restricted_bridge = RestrictedBridge(self)
836 836
837 self._moveFirstLevelToDict(self.options, "url_redirections_dict", sites_names) 837 self._moveFirstLevelToDict(self.options, "url_redirections_dict", sites_names)
838 self._moveFirstLevelToDict(self.options, "menu_json", sites_names) 838 self._moveFirstLevelToDict(self.options, "menu_json", sites_names)
839 if not '' in self.options["menu_json"]: 839 self._moveFirstLevelToDict(self.options, "menu_extra_json", sites_names)
840 self.options["menu_json"][''] = C.DEFAULT_MENU 840 menu = self.options["menu_json"]
841 if not '' in menu:
842 menu[''] = C.DEFAULT_MENU
843 for site, value in self.options["menu_extra_json"].items():
844 menu[site].extend(value)
841 845
842 # we create virtual hosts and import Libervia pages into them 846 # we create virtual hosts and import Libervia pages into them
843 self.vhost_root = vhost.NameVirtualHost() 847 self.vhost_root = vhost.NameVirtualHost()
844 default_site_path = Path(libervia.__file__).parent.resolve() 848 default_site_path = Path(libervia.__file__).parent.resolve()
845 # self.sat_root is official Libervia site 849 # self.sat_root is official Libervia site