200 |
200 |
201 from logilab.common.decorators import cached, classproperty |
201 from logilab.common.decorators import cached, classproperty |
202 from logilab.common.deprecation import deprecated |
202 from logilab.common.deprecation import deprecated |
203 from logilab.common.logging_ext import set_log_methods, init_log |
203 from logilab.common.logging_ext import set_log_methods, init_log |
204 from logilab.common.configuration import (Configuration, Method, |
204 from logilab.common.configuration import (Configuration, Method, |
205 ConfigurationMixIn, merge_options) |
205 ConfigurationMixIn, merge_options, |
|
206 _validate as lgc_validate) |
206 |
207 |
207 from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP, |
208 from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP, |
208 ConfigurationError, Binary, _) |
209 ConfigurationError, Binary, _) |
209 from cubicweb.toolsutils import create_dir, option_value_from_env |
210 from cubicweb.toolsutils import create_dir, option_value_from_env |
210 |
211 |
418 ) |
419 ) |
419 |
420 |
420 def __getitem__(self, key): |
421 def __getitem__(self, key): |
421 """Get configuration option, by first looking at environmnent.""" |
422 """Get configuration option, by first looking at environmnent.""" |
422 file_value = super(CubicWebNoAppConfiguration, self).__getitem__(key) |
423 file_value = super(CubicWebNoAppConfiguration, self).__getitem__(key) |
423 return option_value_from_env(key, file_value) |
424 value = option_value_from_env(key, file_value) |
|
425 if value is not None: |
|
426 option_def = self.get_option_def(key) |
|
427 value = lgc_validate(value, option_def) |
|
428 return value |
424 |
429 |
425 # static and class methods used to get instance independant resources ## |
430 # static and class methods used to get instance independant resources ## |
426 @staticmethod |
431 @staticmethod |
427 def cubicweb_version(): |
432 def cubicweb_version(): |
428 """return installed cubicweb version""" |
433 """return installed cubicweb version""" |