[web server] simplify base-url handling on startup. Ensure config['base-url'] is correctly set once started
--- a/etwist/server.py Mon Mar 15 11:16:40 2010 +0100
+++ b/etwist/server.py Tue Mar 16 12:31:06 2010 +0100
@@ -99,15 +99,11 @@
def __init__(self, config, debug=None):
self.debugmode = debug
self.config = config
- self.base_url = config['base-url'] or config.default_base_url()
- if self.base_url[-1] != '/':
- self.base_url += '/'
- self.https_url = config['https-url']
- if self.https_url and self.https_url[-1] != '/':
- self.https_url += '/'
# instantiate publisher here and not in init_publisher to get some
# checks done before daemonization (eg versions consistency)
self.appli = CubicWebPublisher(config, debug=self.debugmode)
+ self.base_url = config['base-url']
+ self.https_url = config['https-url']
self.versioned_datadir = 'data%s' % config.instance_md5_version()
def init_publisher(self):
--- a/web/webconfig.py Mon Mar 15 11:16:40 2010 +0100
+++ b/web/webconfig.py Tue Mar 16 12:31:06 2010 +0100
@@ -300,10 +300,10 @@
def _init_base_url(self):
# normalize base url(s)
- baseurl = self['base-url']
+ baseurl = self['base-url'] or self.default_base_url()
if baseurl and baseurl[-1] != '/':
baseurl += '/'
- self.global_set_option('base-url', baseurl)
+ self.global_set_option('base-url', baseurl)
httpsurl = self['https-url']
if httpsurl and httpsurl[-1] != '/':
httpsurl += '/'