Revision 3a541d90 lib/utils.py

b/lib/utils.py
497 497
  this list, I{'test1'} as well as I{'test1.example'} will match, but
498 498
  not I{'test1.ex'}. A multiple match will be considered as no match
499 499
  at all (e.g. I{'test1'} against C{['test1.example.com',
500
  'test1.example.org']}).
500
  'test1.example.org']}), except when the key fully matches an entry
501
  (e.g. I{'test1'} against C{['test1', 'test1.example.com']}).
501 502

  
502 503
  @type key: str
503 504
  @param key: the name to be searched
......
509 510
      otherwise the element from the list which matches
510 511

  
511 512
  """
513
  if key in name_list:
514
    return key
512 515
  mo = re.compile("^%s(\..*)?$" % re.escape(key))
513 516
  names_filtered = [name for name in name_list if mo.match(name) is not None]
514 517
  if len(names_filtered) != 1:

Also available in: Unified diff