diff libervia/server/server.py @ 1129:e6fe914c3eaf

server: move first level dict where the key has "/" to default site in _moveFirstLevelToDict
author Goffi <goffi@goffi.org>
date Sat, 15 Sep 2018 19:23:01 +0200
parents 6414fd795df4
children 8a7d75c18d40
line wrap: on
line diff
--- a/libervia/server/server.py	Fri Sep 14 21:41:28 2018 +0200
+++ b/libervia/server/server.py	Sat Sep 15 19:23:01 2018 +0200
@@ -207,11 +207,8 @@
                 # root URL special case
                 old = ""
             elif not old.startswith("/"):
-                log.error(
-                    _(
-                        u"redirected url must start with '/', got {value}. Ignoring"
-                    ).format(value=old)
-                )
+                log.error(_(u"redirected url must start with '/', got {value}. Ignoring")
+                          .format(value=old))
                 continue
             else:
                 old = self._normalizeURL(old)
@@ -1771,7 +1768,9 @@
         default_dict = conf.setdefault(u'', {})
         to_delete = []
         for key, value in conf.iteritems():
-            if not isinstance(value, dict):
+            # "/" can't be present in host name, and help to differenciate from
+            # non vhost dict (which may be used in redirections)
+            if not isinstance(value, dict) or u'/' in key:
                 default_dict[key] = value
                 to_delete.append(key)
         for key in to_delete: