[Python-checkins] python/nondist/peps pep2html.py,1.37,1.38
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Tue, 30 Jul 2002 09:17:13 -0700
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv11177
Modified Files:
pep2html.py
Log Message:
Note! Python 2.2 is now required (you need the email package).
fixfile(): Modify the Author: and Discussions-To: header handling for
the new required format. Since this uses Python 2.2's email package,
it should normalize either old style or new style addresses to the new
style for the web page.
Index: pep2html.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** pep2html.py 28 May 2002 15:46:24 -0000 1.37
--- pep2html.py 30 Jul 2002 16:17:11 -0000 1.38
***************
*** 32,35 ****
--- 32,37 ----
"""
+ # Requires Python 2.2
+
import sys
import os
***************
*** 41,44 ****
--- 43,47 ----
import random
import time
+ from email.Utils import parseaddr
PROGRAM = sys.argv[0]
***************
*** 65,68 ****
--- 68,72 ----
EMPTYSTRING = ''
SPACE = ' '
+ COMMASPACE = ', '
***************
*** 188,204 ****
if k.lower() in ('author', 'discussions-to'):
mailtos = []
! for addr in v.split():
! if '@' in addr:
if k.lower() == 'discussions-to':
m = linkemail(addr, pep)
else:
m = fixemail(addr, pep)
! mailtos.append(m)
! elif addr.startswith('http:'):
mailtos.append(
! '<a href="%s">%s</a>' % (addr, addr))
else:
! mailtos.append(addr)
! v = SPACE.join(mailtos)
elif k.lower() in ('replaces', 'replaced-by'):
otherpeps = ''
--- 192,211 ----
if k.lower() in ('author', 'discussions-to'):
mailtos = []
! for part in re.split(',\s*', v):
! print 'part:', part
! if '@' in part:
! realname, addr = parseaddr(part)
if k.lower() == 'discussions-to':
m = linkemail(addr, pep)
else:
m = fixemail(addr, pep)
! mailtos.append('%s <%s>' % (realname, m))
! elif part.startswith('http:'):
mailtos.append(
! '<a href="%s">%s</a>' % (part, part))
else:
! mailtos.append(part)
! print 'mailtos:', mailtos
! v = COMMASPACE.join(mailtos)
elif k.lower() in ('replaces', 'replaced-by'):
otherpeps = ''