Revision f2b91949 lib/utils/text.py

b/lib/utils/text.py
453 453
  return rlist
454 454

  
455 455

  
456
def EscapeAndJoin(slist, sep=","):
457
  """Encode a list in a way parsable by UnescapeAndSplit.
458

  
459
  @type slist: list of strings
460
  @param slist: the strings to be encoded
461
  @rtype: string
462
  @return: the encoding of the list oas a string
463

  
464
  """
465
  return sep.join([re.sub("\\" + sep, "\\\\" + sep,
466
                          re.sub(r"\\", r"\\\\", v)) for v in slist])
467

  
468

  
456 469
def CommaJoin(names):
457 470
  """Nicely join a set of identifiers.
458 471

  

Also available in: Unified diff