--- a/cwconfig.py Thu Apr 29 11:09:03 2010 +0200
+++ b/cwconfig.py Thu Apr 29 14:21:57 2010 +0200
@@ -293,8 +293,6 @@
log_format = '%(asctime)s - (%(name)s) %(levelname)s: %(message)s'
# nor remove appobjects based on unused interface
cleanup_interface_sobjects = True
- # debug mode
- debugmode = False
if (CWDEV and _forced_mode != 'system'):
@@ -660,9 +658,10 @@
vregpath.append(path + '.py')
return vregpath
- def __init__(self):
+ def __init__(self, debugmode=False):
register_stored_procedures()
ConfigurationMixIn.__init__(self)
+ self.debugmode = debugmode
self.adjust_sys_path()
self.load_defaults()
self.translations = {}
@@ -680,16 +679,14 @@
# overriden in CubicWebConfiguration
self.cls_adjust_sys_path()
- def init_log(self, logthreshold=None, debug=False,
- logfile=None, syslog=False):
+ def init_log(self, logthreshold=None, logfile=None, syslog=False):
"""init the log service"""
if logthreshold is None:
- if debug:
+ if self.debugmode:
logthreshold = 'DEBUG'
else:
logthreshold = self['log-threshold']
- self.debugmode = debug
- init_log(debug, syslog, logthreshold, logfile, self.log_format)
+ init_log(self.debugmode, syslog, logthreshold, logfile, self.log_format)
# configure simpleTal logger
logging.getLogger('simpleTAL').setLevel(logging.ERROR)
@@ -803,12 +800,12 @@
return mdir
@classmethod
- def config_for(cls, appid, config=None):
+ def config_for(cls, appid, config=None, debugmode=False):
"""return a configuration instance for the given instance identifier
"""
config = config or guess_configuration(cls.instance_home(appid))
configcls = configuration_cls(config)
- return configcls(appid)
+ return configcls(appid, debugmode)
@classmethod
def possible_configurations(cls, appid):
@@ -876,9 +873,9 @@
# instance methods used to get instance specific resources #############
- def __init__(self, appid):
+ def __init__(self, appid, debugmode=False):
self.appid = appid
- CubicWebNoAppConfiguration.__init__(self)
+ CubicWebNoAppConfiguration.__init__(self, debugmode)
self._cubes = None
self._site_loaded = set()
self.load_file_configuration(self.main_config_file())
@@ -990,12 +987,12 @@
# init gettext
self._set_language()
- def init_log(self, logthreshold=None, debug=False, force=False):
+ def init_log(self, logthreshold=None, force=False):
"""init the log service"""
if not force and hasattr(self, '_logging_initialized'):
return
self._logging_initialized = True
- CubicWebNoAppConfiguration.init_log(self, logthreshold, debug,
+ CubicWebNoAppConfiguration.init_log(self, logthreshold,
logfile=self.get('log-file'))
# read a config file if it exists
logconfig = join(self.apphome, 'logging.conf')