|
|
@ -19,6 +19,7 @@ |
|
|
|
# |
|
|
|
############################################################################## |
|
|
|
|
|
|
|
import logging |
|
|
|
import os |
|
|
|
import ConfigParser |
|
|
|
from lxml import etree |
|
|
@ -29,19 +30,23 @@ from openerp.tools.config import config as system_base_config |
|
|
|
|
|
|
|
from .system_info import get_server_environment |
|
|
|
|
|
|
|
from openerp.addons import server_environment_files |
|
|
|
_dir = os.path.dirname(server_environment_files.__file__) |
|
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
# Same dict as RawConfigParser._boolean_states |
|
|
|
_boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, |
|
|
|
'0': False, 'no': False, 'false': False, 'off': False} |
|
|
|
|
|
|
|
try: |
|
|
|
from openerp.addons import server_environment_files |
|
|
|
|
|
|
|
_dir = os.path.dirname(server_environment_files.__file__) |
|
|
|
|
|
|
|
if not system_base_config.get('running_env', False): |
|
|
|
raise Exception( |
|
|
|
"The parameter 'running_env' has not be set neither in base config " |
|
|
|
"file option -c or in openerprc.\n" |
|
|
|
"We strongly recommend against using the rc file but instead use an " |
|
|
|
"explicit config file with this content:\n" |
|
|
|
"The parameter 'running_env' has not be set neither in base " |
|
|
|
"config file option -c or in openerprc.\n" |
|
|
|
"We strongly recommend against using the rc file but instead use " |
|
|
|
"an explicit config file with this content:\n" |
|
|
|
"[options]\nrunning_env = dev" |
|
|
|
) |
|
|
|
|
|
|
@ -52,6 +57,10 @@ if not os.path.exists(ck_path): |
|
|
|
"Provided server environment does not exist, " |
|
|
|
"please add a folder %s" % ck_path |
|
|
|
) |
|
|
|
except ImportError: |
|
|
|
_logger.info("ImportError raised while loading module.") |
|
|
|
_logger.debug("ImportError details:", exc_info=True) |
|
|
|
server_environment_files = False |
|
|
|
|
|
|
|
|
|
|
|
def setboolean(obj, attr, _bool=None): |
|
|
@ -104,6 +113,7 @@ def _load_config(): |
|
|
|
return config_p |
|
|
|
|
|
|
|
|
|
|
|
if server_environment_files: |
|
|
|
serv_config = _load_config() |
|
|
|
|
|
|
|
|
|
|
|