Revision 21d7df5f

b/lib/cmdlib.py
475 475
  return wanted
476 476

  
477 477

  
478
def _GetUpdatedParams(old_params, update_dict):
478
def _GetUpdatedParams(old_params, update_dict,
479
                      use_default=True, use_none=False):
479 480
  """Return the new version of a parameter dictionary.
480 481

  
481 482
  @type old_params: dict
......
484 485
  @param update_dict: dict containing new parameter values, or
485 486
      constants.VALUE_DEFAULT to reset the parameter to its default
486 487
      value
488
  @param use_default: boolean
489
  @type use_default: whether to recognise L{constants.VALUE_DEFAULT}
490
      values as 'to be deleted' values
491
  @param use_none: boolean
492
  @type use_none: whether to recognise C{None} values as 'to be
493
      deleted' values
487 494
  @rtype: dict
488 495
  @return: the new parameter dictionary
489 496

  
490 497
  """
491 498
  params_copy = copy.deepcopy(old_params)
492 499
  for key, val in update_dict.iteritems():
493
    if val == constants.VALUE_DEFAULT:
500
    if ((use_default and val == constants.VALUE_DEFAULT) or
501
        (use_none and val is None)):
494 502
      try:
495 503
        del params_copy[key]
496 504
      except KeyError:

Also available in: Unified diff