changeset 1191:ba45dcdbeeaf

server: fixed sites alias: host aliases were incorrectly detected (existing_vhosts was not filled) and pages were imported several times.
author Goffi <goffi@goffi.org>
date Mon, 27 May 2019 21:10:44 +0200
parents b9a5418e9f2e
children 7b05ebc46141
files libervia/server/server.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/server.py	Mon May 27 09:27:15 2019 +0200
+++ b/libervia/server/server.py	Mon May 27 21:10:44 2019 +0200
@@ -1922,6 +1922,8 @@
                     site_path=site_path,
                     path=root_path)
 
+                existing_vhosts[site_name] = res
+
                 if self.options['dev_mode']:
                     self.files_watcher.watchDir(
                         site_path, auto_add=True, recursive=True,
@@ -1930,14 +1932,16 @@
                 tasks_manager = TasksManager(self, res)
                 yield tasks_manager.runTasks()
                 res.putChild(C.BUILD_DIR, static.File(self.getBuildPath(site_name)))
+
+                LiberviaPage.importPages(self, res)
+                # FIXME: default pages are accessible if not overriden by external website
+                #        while necessary for login or re-using existing pages
+                #        we may want to disable access to the page by direct URL
+                #        (e.g. /blog disabled except if called by external site)
+                LiberviaPage.importPages(self, res, root_path=default_site_path)
+                res._setMenu(self.options["menu_json"])
+
             self.vhost_root.addHost(host_name.encode('utf-8'), res)
-            LiberviaPage.importPages(self, res)
-            # FIXME: default pages are accessible if not overriden by external website
-            #        while necessary for login or re-using existing pages
-            #        we may want to disable access to the page by direct URL
-            #        (e.g. /blog disabled except if called by external site)
-            LiberviaPage.importPages(self, res, root_path=default_site_path)
-            res._setMenu(self.options["menu_json"])
 
         templates_res = web_resource.Resource()
         self.putChildAll(C.TPL_RESOURCE, templates_res)