def getValue()

in scripts/yapl/Utilities.py [0:0]


def getValue(args,synonyms,default=None):
  """
    Return the value from the given args dictionary for the attribute name in the list of given synonym names.
    
    args is a dictionary (A "rest args" argument dictionary can be passed in directly as well, e.g., **restArgs 
    may be passed in as restArgs.)
    
    synonyms is a Jython list of names (strings) that may be used to access entries in the args dictionary.
    synonyms may also be a string with separators as defined in NameSeparators.
    
    The getValue() method is a convenience for getting a value for a dictionary where there is more than one
    name that may be used for the entry in the dictionary.  In the case of the application definition dictionary
    there are several attributes that may be referred to with more than one name.  (The argument names used by  
    the wsadmin AdminApp methods are often inconsistent with respect to naming conventions. This module provides 
    more readable aliases for many of the AdminApp method argument names.)
  """
  value = None
  
  if (type(synonyms) != type([])):     
    synonyms = 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