cwconfig.py
changeset 10622 3cc6154b94a3
parent 10614 57dfde80df11
child 10662 10942ed172de
equal deleted inserted replaced
10621:987fbc88f097 10622:3cc6154b94a3
   177 from smtplib import SMTP
   177 from smtplib import SMTP
   178 from threading import Lock
   178 from threading import Lock
   179 from os.path import (exists, join, expanduser, abspath, normpath,
   179 from os.path import (exists, join, expanduser, abspath, normpath,
   180                      basename, isdir, dirname, splitext)
   180                      basename, isdir, dirname, splitext)
   181 from warnings import warn, filterwarnings
   181 from warnings import warn, filterwarnings
       
   182 
       
   183 from six import text_type
   182 
   184 
   183 from logilab.common.decorators import cached, classproperty
   185 from logilab.common.decorators import cached, classproperty
   184 from logilab.common.deprecation import deprecated
   186 from logilab.common.deprecation import deprecated
   185 from logilab.common.logging_ext import set_log_methods, init_log
   187 from logilab.common.logging_ext import set_log_methods, init_log
   186 from logilab.common.configuration import (Configuration, Method,
   188 from logilab.common.configuration import (Configuration, Method,
   649         super(CubicWebNoAppConfiguration, self).__init__()
   651         super(CubicWebNoAppConfiguration, self).__init__()
   650         self.debugmode = debugmode
   652         self.debugmode = debugmode
   651         self.adjust_sys_path()
   653         self.adjust_sys_path()
   652         self.load_defaults()
   654         self.load_defaults()
   653         # will be properly initialized later by _gettext_init
   655         # will be properly initialized later by _gettext_init
   654         self.translations = {'en': (unicode, lambda ctx, msgid: unicode(msgid) )}
   656         self.translations = {'en': (text_type, lambda ctx, msgid: text_type(msgid) )}
   655         self._site_loaded = set()
   657         self._site_loaded = set()
   656         # don't register ReStructured Text directives by simple import, avoid pb
   658         # don't register ReStructured Text directives by simple import, avoid pb
   657         # with eg sphinx.
   659         # with eg sphinx.
   658         # XXX should be done properly with a function from cw.uicfg
   660         # XXX should be done properly with a function from cw.uicfg
   659         try:
   661         try:
  1007     def __init__(self, appid, debugmode=False, creating=False):
  1009     def __init__(self, appid, debugmode=False, creating=False):
  1008         self.appid = appid
  1010         self.appid = appid
  1009         # set to true while creating an instance
  1011         # set to true while creating an instance
  1010         self.creating = creating
  1012         self.creating = creating
  1011         super(CubicWebConfiguration, self).__init__(debugmode)
  1013         super(CubicWebConfiguration, self).__init__(debugmode)
  1012         fake_gettext = (unicode, lambda ctx, msgid: unicode(msgid))
  1014         fake_gettext = (text_type, lambda ctx, msgid: text_type(msgid))
  1013         for lang in self.available_languages():
  1015         for lang in self.available_languages():
  1014             self.translations[lang] = fake_gettext
  1016             self.translations[lang] = fake_gettext
  1015         self._cubes = None
  1017         self._cubes = None
  1016         self.load_file_configuration(self.main_config_file())
  1018         self.load_file_configuration(self.main_config_file())
  1017 
  1019