/[qa]/trunk/pts/www/bin/sources_to_xml.py
ViewVC logotype

Diff of /trunk/pts/www/bin/sources_to_xml.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 570 by hertzog, Sun May 4 15:15:46 2003 UTC revision 571 by hertzog, Fri May 9 08:04:38 2003 UTC
# Line 24  def address_from_string(content): Line 24  def address_from_string(content):
24      return (string.replace(name,"WEWANTNOCOMMAS",","),string.replace(mail,"WEWANTNOCOMMAS",","))      return (string.replace(name,"WEWANTNOCOMMAS",","),string.replace(mail,"WEWANTNOCOMMAS",","))
25    
26  # addresses_from_string takes a string with addresses in RFC822 format  # addresses_from_string takes a string with addresses in RFC822 format
27  # and changes it into a list of tuples of the form (real name, email). [PvR]  # and changes it into a list of tuples of the form (real name, email).
28    # Just as address_from_string, it tries to be forgiving about unquoted
29    # commas in addresses. [PvR]
30  def addresses_from_string(content):  def addresses_from_string(content):
31      msg = email.message_from_string("Header: " + content)      pattern = re.compile("([^>]),")
32      return email.Utils.getaddresses(msg.get_all("Header", []))      hacked_content = pattern.sub("\\1WEWANTNOCOMMAS", content)
33        msg = email.message_from_string("Header: " + hacked_content)
34        hacked_list = email.Utils.getaddresses(msg.get_all("Header", []))
35        list = map(lambda p:
36                   map(lambda s:string.replace(s,"WEWANTNOCOMMAS",","), p),
37                   hacked_list)
38        return list
39    
40  def add_maintainer_info(child, name, mail, doc):  def add_maintainer_info(child, name, mail, doc):
41      text = doc.createTextNode(unicode(name,'iso-8859-1')) # Take care of non-ascii      text = doc.createTextNode(unicode(name,'iso-8859-1')) # Take care of non-ascii

Legend:
Removed from v.570  
changed lines
  Added in v.571

  ViewVC Help
Powered by ViewVC 1.1.5