[webconfig] fallback to default configs if https ones are not defined stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 08 Apr 2013 16:19:29 +0200
branchstable
changeset 8869 a46197b1696f
parent 8868 12f29b0ed0bb
child 8870 c9d18b8dbfea
[webconfig] fallback to default configs if https ones are not defined When cubicweb serves a request with an https scheme, it tries to access ``https_uiprops`` and ``https_datadir_urls``. However if those are not defined we should fallback to unsecure url instead of crashing with a traceback. There are very valid usecases for undefined https url. For example if your ``base_url``, ``datadir_url`` and uiprops content are already https urls. Closes #2786643
web/request.py
--- a/web/request.py	Mon Apr 08 16:13:03 2013 +0200
+++ b/web/request.py	Mon Apr 08 16:19:29 2013 +0200
@@ -100,11 +100,13 @@
         self.uiprops = None
         #: url for serving datadir (vary with https) (see :ref:`resources`)
         self.datadir_url = None
-        if https:
+        if https and vreg.config.https_uiprops is not None:
             self.uiprops = vreg.config.https_uiprops
+        else:
+            self.uiprops = vreg.config.uiprops
+        if https and vreg.config.https_datadir_url is not None:
             self.datadir_url = vreg.config.https_datadir_url
         else:
-            self.uiprops = vreg.config.uiprops
             self.datadir_url = vreg.config.datadir_url
         #: raw html headers that can be added from any view
         self.html_headers = HTMLHead(self)