cwconfig.py
brancholdstable
changeset 6748 52226299c352
parent 6741 b9ffecd0316a
child 6749 48f468f33704
equal deleted inserted replaced
6747:63bf61e4e130 6748:52226299c352
   679                     vregpath.append(path + '.py')
   679                     vregpath.append(path + '.py')
   680         return vregpath
   680         return vregpath
   681 
   681 
   682     def __init__(self, debugmode=False):
   682     def __init__(self, debugmode=False):
   683         register_stored_procedures()
   683         register_stored_procedures()
   684         ConfigurationMixIn.__init__(self)
   684         super(CubicWebNoAppConfiguration, self).__init__()
   685         self.debugmode = debugmode
   685         self.debugmode = debugmode
   686         self.adjust_sys_path()
   686         self.adjust_sys_path()
   687         self.load_defaults()
   687         self.load_defaults()
   688         # will be properly initialized later by _gettext_init
   688         # will be properly initialized later by _gettext_init
   689         self.translations = {'en': (unicode, lambda ctx, msgid: unicode(msgid) )}
   689         self.translations = {'en': (unicode, lambda ctx, msgid: unicode(msgid) )}
   944 
   944 
   945     # instance methods used to get instance specific resources #############
   945     # instance methods used to get instance specific resources #############
   946 
   946 
   947     def __init__(self, appid, debugmode=False):
   947     def __init__(self, appid, debugmode=False):
   948         self.appid = appid
   948         self.appid = appid
   949         CubicWebNoAppConfiguration.__init__(self, debugmode)
   949         super(CubicWebConfiguration, self).__init__(debugmode)
   950         self._cubes = None
   950         self._cubes = None
   951         self.load_file_configuration(self.main_config_file())
   951         self.load_file_configuration(self.main_config_file())
   952 
   952 
   953     def adjust_sys_path(self):
   953     def adjust_sys_path(self):
   954         CubicWebNoAppConfiguration.adjust_sys_path(self)
   954         super(CubicWebConfiguration, self).adjust_sys_path()
   955         # adding apphome to python path is not usually necessary in production
   955         # adding apphome to python path is not usually necessary in production
   956         # environments, but necessary for tests
   956         # environments, but necessary for tests
   957         if self.apphome and not self.apphome in sys.path:
   957         if self.apphome and not self.apphome in sys.path:
   958             sys.path.insert(0, self.apphome)
   958             sys.path.insert(0, self.apphome)
   959 
   959 
  1067     def init_log(self, logthreshold=None, force=False):
  1067     def init_log(self, logthreshold=None, force=False):
  1068         """init the log service"""
  1068         """init the log service"""
  1069         if not force and hasattr(self, '_logging_initialized'):
  1069         if not force and hasattr(self, '_logging_initialized'):
  1070             return
  1070             return
  1071         self._logging_initialized = True
  1071         self._logging_initialized = True
  1072         CubicWebNoAppConfiguration.init_log(self, logthreshold,
  1072         super_self = super(CubicWebConfiguration, self)
  1073                                             logfile=self.get('log-file'))
  1073         super_self.init_log(logthreshold, logfile=self.get('log-file'))
  1074         # read a config file if it exists
  1074         # read a config file if it exists
  1075         logconfig = join(self.apphome, 'logging.conf')
  1075         logconfig = join(self.apphome, 'logging.conf')
  1076         if exists(logconfig):
  1076         if exists(logconfig):
  1077             logging.fileConfig(logconfig)
  1077             logging.fileConfig(logconfig)
  1078 
  1078