in scripts/cp4s_install.py [0:0]
def _getArg(self,synonyms,args,default=None):
"""
Return the value from the args dictionary that may be specified with any of the
argument names in the list of synonyms.
The synonyms argument may be a Jython list of strings or it may be a string representation
of a list of names with a comma or space separating each name.
The args is a dictionary with the keyword value pairs that are the arguments
that may have one of the names in the synonyms list.
If the args dictionary does not include the option that may be named by any
of the given synonyms then the given default value is returned.
NOTE: This method has to be careful to make explicit checks for value being None
rather than something that is just logically false. If value gets assigned 0 from
the get on the args (command line args) dictionary, that appears as false in a
condition expression. However 0 may be a legitimate value for an input parameter
in the args dictionary. We need to break out of the loop that is checking synonyms
as well as avoid assigning the default value if 0 is the value provided in the
args dictionary.
"""
value = None
if (type(synonyms) != type([])):
synonyms = Utilities.splitString(synonyms)
#endIf
for name in synonyms:
value = args.get(name)
if (value != None):
break
#endIf
#endFor
if (value == None and default != None):
value = default
#endIf
return value