11# Roundup Issue Tracker configuration support
22#
3- # $Id: configuration.py,v 1.28 2005-12-03 09:31:00 a1s Exp $
3+ # $Id: configuration.py,v 1.29 2005-12-03 11:21:17 a1s Exp $
44#
55__docformat__ = "restructuredtext"
66
@@ -662,7 +662,7 @@ class Config:
662662 # actual name of the config file. set on load.
663663 filepath = os .path .join (HOME , INI_FILE )
664664
665- def __init__ (self , config_path = None , layout = None ):
665+ def __init__ (self , config_path = None , layout = None , settings = {} ):
666666 """Initialize confing instance
667667
668668 Parameters:
@@ -674,6 +674,9 @@ def __init__(self, config_path=None, layout=None):
674674 layout:
675675 optional configuration layout, a sequence of
676676 section definitions suitable for .add_section()
677+ settings:
678+ optional setting overrides (dictionary).
679+ The overrides are applied after loading config file.
677680
678681 """
679682 # initialize option containers:
@@ -687,6 +690,8 @@ def __init__(self, config_path=None, layout=None):
687690 self .add_section (* section )
688691 if config_path is not None :
689692 self .load (config_path )
693+ for (name , value ) in settings .items ():
694+ self [name .upper ()] = value
690695
691696 def add_section (self , section , options , description = None ):
692697 """Define new config section
@@ -1079,8 +1084,8 @@ class CoreConfig(Config):
10791084 ext = None
10801085 detectors = None
10811086
1082- def __init__ (self , home_dir = None ):
1083- Config .__init__ (self , home_dir , SETTINGS )
1087+ def __init__ (self , home_dir = None , settings = {} ):
1088+ Config .__init__ (self , home_dir , layout = SETTINGS , settings = settings )
10841089 # load the config if home_dir given
10851090 if home_dir is None :
10861091 self .init_logging ()
0 commit comments