111 'default': None, |
111 'default': None, |
112 'help': 'web instance query log file', |
112 'help': 'web instance query log file', |
113 'group': 'web', 'level': 3, |
113 'group': 'web', 'level': 3, |
114 }), |
114 }), |
115 # web configuration |
115 # web configuration |
116 ('https-url', |
|
117 {'type' : 'string', |
|
118 'default': None, |
|
119 'help': 'web server root url on https. By specifying this option your '\ |
|
120 'site can be available as an http and https site. Authenticated users '\ |
|
121 'will in this case be authenticated and once done navigate through the '\ |
|
122 'https site. IMPORTANTE NOTE: to do this work, you should have your '\ |
|
123 'apache redirection include "https" as base url path so cubicweb can '\ |
|
124 'differentiate between http vs https access. For instance: \n'\ |
|
125 'RewriteRule ^/demo/(.*) http://127.0.0.1:8080/https/$1 [L,P]\n'\ |
|
126 'where the cubicweb web server is listening on port 8080.', |
|
127 'group': 'main', 'level': 3, |
|
128 }), |
|
129 ('datadir-url', |
116 ('datadir-url', |
130 {'type': 'string', 'default': None, |
117 {'type': 'string', 'default': None, |
131 'help': ('base url for static data, if different from "${base-url}/data/". ' |
118 'help': ('base url for static data, if different from "${base-url}/data/". ' |
132 'If served from a different domain, that domain should allow ' |
119 'If served from a different domain, that domain should allow ' |
133 'cross-origin requests.'), |
120 'cross-origin requests.'), |
267 )) |
254 )) |
268 |
255 |
269 def __init__(self, *args, **kwargs): |
256 def __init__(self, *args, **kwargs): |
270 super(WebConfiguration, self).__init__(*args, **kwargs) |
257 super(WebConfiguration, self).__init__(*args, **kwargs) |
271 self.uiprops = None |
258 self.uiprops = None |
272 self.https_uiprops = None |
|
273 self.datadir_url = None |
259 self.datadir_url = None |
274 self.https_datadir_url = None |
|
275 |
260 |
276 def fckeditor_installed(self): |
261 def fckeditor_installed(self): |
277 if self.uiprops is None: |
262 if self.uiprops is None: |
278 return False |
263 return False |
279 return exists(self.uiprops.get('FCKEDITOR_PATH', '')) |
264 return exists(self.uiprops.get('FCKEDITOR_PATH', '')) |
388 if self.datadir_url: |
373 if self.datadir_url: |
389 if self.datadir_url[-1] != '/': |
374 if self.datadir_url[-1] != '/': |
390 self.datadir_url += '/' |
375 self.datadir_url += '/' |
391 if self.mode != 'test': |
376 if self.mode != 'test': |
392 self.datadir_url += '%s/' % self.instance_md5_version() |
377 self.datadir_url += '%s/' % self.instance_md5_version() |
393 self.https_datadir_url = self.datadir_url |
|
394 return |
378 return |
395 httpsurl = self['https-url'] |
|
396 data_relpath = self.data_relpath() |
379 data_relpath = self.data_relpath() |
397 if httpsurl: |
|
398 if httpsurl[-1] != '/': |
|
399 httpsurl += '/' |
|
400 if not self.repairing: |
|
401 self.global_set_option('https-url', httpsurl) |
|
402 self.https_datadir_url = httpsurl + data_relpath |
|
403 self.datadir_url = baseurl + data_relpath |
380 self.datadir_url = baseurl + data_relpath |
404 |
381 |
405 def data_relpath(self): |
382 def data_relpath(self): |
406 if self.mode == 'test': |
383 if self.mode == 'test': |
407 return 'data/' |
384 return 'data/' |
415 self.uiprops = PropertySheet( |
392 self.uiprops = PropertySheet( |
416 cachedir, |
393 cachedir, |
417 data=lambda x: self.datadir_url + x, |
394 data=lambda x: self.datadir_url + x, |
418 datadir_url=self.datadir_url[:-1]) |
395 datadir_url=self.datadir_url[:-1]) |
419 self._init_uiprops(self.uiprops) |
396 self._init_uiprops(self.uiprops) |
420 if self['https-url']: |
|
421 cachedir = join(self.appdatahome, 'uicachehttps') |
|
422 self.check_writeable_uid_directory(cachedir) |
|
423 self.https_uiprops = PropertySheet( |
|
424 cachedir, |
|
425 data=lambda x: self.https_datadir_url + x, |
|
426 datadir_url=self.https_datadir_url[:-1]) |
|
427 self._init_uiprops(self.https_uiprops) |
|
428 |
397 |
429 def _init_uiprops(self, uiprops): |
398 def _init_uiprops(self, uiprops): |
430 libuiprops = join(self.shared_dir(), 'data', 'uiprops.py') |
399 libuiprops = join(self.shared_dir(), 'data', 'uiprops.py') |
431 uiprops.load(libuiprops) |
400 uiprops.load(libuiprops) |
432 for path in reversed([self.apphome] + self.cubes_path()): |
401 for path in reversed([self.apphome] + self.cubes_path()): |