Minor improvement so that user's options can also be passed directly as a dictionary/advancedDict rather than only as an optparse instance.

This commit is contained in:
Bernardo Damele 2009-06-05 10:15:55 +00:00
parent 5ac2b0658c
commit 3bca0d4b28

View File

@ -949,7 +949,12 @@ def __mergeOptions(inputOptions):
if inputOptions.configFile: if inputOptions.configFile:
configFileParser(inputOptions.configFile) configFileParser(inputOptions.configFile)
for key, value in inputOptions.__dict__.items(): if hasattr(inputOptions, "items"):
inputOptionsItems = inputOptions.items()
else:
inputOptionsItems = inputOptions.__dict__.items()
for key, value in inputOptionsItems:
if not conf.has_key(key) or conf[key] == None or value != None: if not conf.has_key(key) or conf[key] == None or value != None:
conf[key] = value conf[key] = value