equal
deleted
inserted
replaced
164 .. envvar:: CW_RUNTIME_DIR |
164 .. envvar:: CW_RUNTIME_DIR |
165 |
165 |
166 Directory where pid files will be written |
166 Directory where pid files will be written |
167 """ |
167 """ |
168 |
168 |
169 from __future__ import print_function |
|
170 |
|
171 import importlib |
169 import importlib |
172 import logging |
170 import logging |
173 import logging.config |
171 import logging.config |
174 import os |
172 import os |
175 from os.path import (exists, join, expanduser, abspath, |
173 from os.path import (exists, join, expanduser, abspath, |
179 from smtplib import SMTP |
177 from smtplib import SMTP |
180 import stat |
178 import stat |
181 import sys |
179 import sys |
182 from threading import Lock |
180 from threading import Lock |
183 from warnings import filterwarnings |
181 from warnings import filterwarnings |
184 |
|
185 from six import text_type |
|
186 |
182 |
187 from logilab.common.decorators import cached |
183 from logilab.common.decorators import cached |
188 from logilab.common.logging_ext import set_log_methods, init_log |
184 from logilab.common.logging_ext import set_log_methods, init_log |
189 from logilab.common.configuration import (Configuration, Method, |
185 from logilab.common.configuration import (Configuration, Method, |
190 ConfigurationMixIn, merge_options, |
186 ConfigurationMixIn, merge_options, |
639 super(CubicWebNoAppConfiguration, self).__init__() |
635 super(CubicWebNoAppConfiguration, self).__init__() |
640 self.debugmode = debugmode |
636 self.debugmode = debugmode |
641 self.adjust_sys_path() |
637 self.adjust_sys_path() |
642 self.load_defaults() |
638 self.load_defaults() |
643 # will be properly initialized later by _gettext_init |
639 # will be properly initialized later by _gettext_init |
644 self.translations = {'en': (text_type, lambda ctx, msgid: text_type(msgid) )} |
640 self.translations = {'en': (str, lambda ctx, msgid: str(msgid) )} |
645 self._site_loaded = set() |
641 self._site_loaded = set() |
646 # don't register ReStructured Text directives by simple import, avoid pb |
642 # don't register ReStructured Text directives by simple import, avoid pb |
647 # with eg sphinx. |
643 # with eg sphinx. |
648 # XXX should be done properly with a function from cw.uicfg |
644 # XXX should be done properly with a function from cw.uicfg |
649 try: |
645 try: |
988 def __init__(self, appid, debugmode=False, creating=False): |
984 def __init__(self, appid, debugmode=False, creating=False): |
989 self.appid = appid |
985 self.appid = appid |
990 # set to true while creating an instance |
986 # set to true while creating an instance |
991 self.creating = creating |
987 self.creating = creating |
992 super(CubicWebConfiguration, self).__init__(debugmode) |
988 super(CubicWebConfiguration, self).__init__(debugmode) |
993 fake_gettext = (text_type, lambda ctx, msgid: text_type(msgid)) |
989 fake_gettext = (str, lambda ctx, msgid: str(msgid)) |
994 for lang in self.available_languages(): |
990 for lang in self.available_languages(): |
995 self.translations[lang] = fake_gettext |
991 self.translations[lang] = fake_gettext |
996 self._cubes = None |
992 self._cubes = None |
997 self.load_file_configuration(self.main_config_file()) |
993 self.load_file_configuration(self.main_config_file()) |
998 |
994 |