22 |
22 |
23 import os |
23 import os |
24 import hmac |
24 import hmac |
25 from uuid import uuid4 |
25 from uuid import uuid4 |
26 from os.path import dirname, join, exists, split, isdir |
26 from os.path import dirname, join, exists, split, isdir |
27 from warnings import warn |
|
28 |
27 |
29 from six import text_type |
28 from six import text_type |
30 |
29 |
31 from logilab.common.decorators import cached, cachedproperty |
30 from logilab.common.decorators import cached, cachedproperty |
32 from logilab.common.configuration import Method, merge_options |
31 from logilab.common.configuration import Method, merge_options |
337 """ |
336 """ |
338 directory = self._fs_path_locate(rid, rdirectory) |
337 directory = self._fs_path_locate(rid, rdirectory) |
339 if directory is None: |
338 if directory is None: |
340 return None, None |
339 return None, None |
341 if self['use-uicache'] and rdirectory == 'data' and rid.endswith('.css'): |
340 if self['use-uicache'] and rdirectory == 'data' and rid.endswith('.css'): |
342 if rid == 'cubicweb.old.css': |
|
343 # @import('cubicweb.css') in css |
|
344 warn('[3.20] cubicweb.old.css has been renamed back to cubicweb.css', |
|
345 DeprecationWarning) |
|
346 rid = 'cubicweb.css' |
|
347 return self.ensure_uid_directory( |
341 return self.ensure_uid_directory( |
348 self.uiprops.process_resource( |
342 self.uiprops.process_resource( |
349 join(directory, rdirectory), rid)), rid |
343 join(directory, rdirectory), rid)), rid |
350 return join(directory, rdirectory), rid |
344 return join(directory, rdirectory), rid |
351 |
345 |
402 uiprops.load(libuiprops) |
396 uiprops.load(libuiprops) |
403 for path in reversed([self.apphome] + self.cubes_path()): |
397 for path in reversed([self.apphome] + self.cubes_path()): |
404 self._load_ui_properties_file(uiprops, path) |
398 self._load_ui_properties_file(uiprops, path) |
405 self._load_ui_properties_file(uiprops, self.apphome) |
399 self._load_ui_properties_file(uiprops, self.apphome) |
406 datadir_url = uiprops.context['datadir_url'] |
400 datadir_url = uiprops.context['datadir_url'] |
407 if (datadir_url + '/cubicweb.old.css') in uiprops['STYLESHEETS']: |
|
408 warn('[3.20] cubicweb.old.css has been renamed back to cubicweb.css', |
|
409 DeprecationWarning) |
|
410 idx = uiprops['STYLESHEETS'].index(datadir_url + '/cubicweb.old.css') |
|
411 uiprops['STYLESHEETS'][idx] = datadir_url + '/cubicweb.css' |
|
412 if datadir_url + '/cubicweb.reset.css' in uiprops['STYLESHEETS']: |
|
413 warn('[3.20] cubicweb.reset.css is obsolete', DeprecationWarning) |
|
414 uiprops['STYLESHEETS'].remove(datadir_url + '/cubicweb.reset.css') |
|
415 cubicweb_js_url = datadir_url + '/cubicweb.js' |
401 cubicweb_js_url = datadir_url + '/cubicweb.js' |
416 if cubicweb_js_url not in uiprops['JAVASCRIPTS']: |
402 if cubicweb_js_url not in uiprops['JAVASCRIPTS']: |
417 uiprops['JAVASCRIPTS'].insert(0, cubicweb_js_url) |
403 uiprops['JAVASCRIPTS'].insert(0, cubicweb_js_url) |
418 |
404 |
419 def _load_ui_properties_file(self, uiprops, path): |
405 def _load_ui_properties_file(self, uiprops, path): |