# HG changeset patch # User Pierre-Yves David # Date 1329839923 -3600 # Node ID 1c5be4a1afd1caa121053696ca87965db4880ead # Parent 88a7d2c49d39b42e73502c47ea847a80bbf77503 [web/config] refactor initialization of the data url Common logic have been moved in a dedicated `data_relpath` function. diff -r 88a7d2c49d39 -r 1c5be4a1afd1 web/webconfig.py --- a/web/webconfig.py Thu Feb 23 11:58:16 2012 +0100 +++ b/web/webconfig.py Tue Feb 21 16:58:43 2012 +0100 @@ -321,17 +321,20 @@ if not (self.repairing or self.creating): self.global_set_option('base-url', baseurl) httpsurl = self['https-url'] - if (self.debugmode or self.mode == 'test'): - datadir_path = 'data/' - else: - datadir_path = 'data/%s/' % self.instance_md5_version() + data_relpath = self.data_relpath() if httpsurl: if httpsurl[-1] != '/': httpsurl += '/' if not self.repairing: self.global_set_option('https-url', httpsurl) - self.https_datadir_url = httpsurl + datadir_path - self.datadir_url = baseurl + datadir_path + self.https_datadir_url = httpsurl + data_relpath + self.datadir_url = baseurl + data_relpath + + def data_relpath(self): + if (self.debugmode or self.mode == 'test'): + return 'data/' + else: + return 'data/%s/' % self.instance_md5_version() def _build_ui_properties(self): # self.datadir_url[:-1] to remove trailing /