[server] take a chance to grab base-url from all-in-one config if not specified explicitly
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 24 Jul 2009 10:36:57 +0200
changeset 2466 c4ccfd38a542
parent 2465 cc18a700a2be
child 2467 6983631f5d0d
[server] take a chance to grab base-url from all-in-one config if not specified explicitly
server/session.py
--- a/server/session.py	Fri Jul 24 09:31:43 2009 +0200
+++ b/server/session.py	Fri Jul 24 10:36:57 2009 +0200
@@ -194,7 +194,14 @@
         raise KeyError(eid)
 
     def base_url(self):
-        return self.repo.config['base-url'] or u''
+        url = self.repo.config['base-url']
+        if not url:
+            try:
+                url = self.repo.config.default_base_url()
+            except AttributeError: # default_base_url() might not be available
+                self.warning('missing base-url definition in server config')
+                url = u''
+        return url
 
     def from_controller(self):
         """return the id (string) of the controller issuing the request (no