Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 1299:b2d04ce03802
Email improvements.
- updated email package address formatting (deprecation)
- copied email address quoting from email v2.4.3 so we're consistent with 2.2
- email summary extraction now takes the first whole sentence or line -
whichever is longer
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 05 Nov 2002 22:59:46 +0000 |
| parents | fe67477e678f |
| children | 328d68db2ef8 |
line wrap: on
line diff
--- a/roundup/roundupdb.py Thu Oct 31 04:07:12 2002 +0000 +++ b/roundup/roundupdb.py Tue Nov 05 22:59:46 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.72 2002-10-08 07:28:34 richard Exp $ +# $Id: roundupdb.py,v 1.73 2002-11-05 22:59:46 richard Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -26,9 +26,19 @@ import base64, quopri, mimetypes # if available, use the 'email' module, otherwise fallback to 'rfc822' try : - from email.Utils import dump_address_pair as straddr + from email.Utils import formataddr as straddr except ImportError : - from rfc822 import dump_address_pair as straddr + # code taken from the email package 2.4.3 + def straddr(pair, specialsre = re.compile(r'[][\()<>@,:;".]'), + escapesre = re.compile(r'[][\()"]')): + name, address = pair + if name: + quotes = '' + if specialsre.search(name): + quotes = '"' + name = escapesre.sub(r'\\\g<0>', name) + return '%s%s%s <%s>' % (quotes, name, quotes, address) + return address import hyperdb
