Added support for Last-Modified header and its (possibly automatic)
generation.
This commit is contained in:
parent
d9736b39aa
commit
e7818687b7
|
@ -6,6 +6,7 @@ Status: Draft
|
|||
Type: Standards Track
|
||||
Python-Version: 2.3
|
||||
Created: 06-Jun-2001
|
||||
Last-Modified:
|
||||
Post-History:
|
||||
|
||||
Abstract
|
||||
|
|
19
pep2html.py
19
pep2html.py
|
@ -31,11 +31,12 @@ import cgi
|
|||
import glob
|
||||
import getopt
|
||||
import errno
|
||||
import time
|
||||
|
||||
PROGRAM = sys.argv[0]
|
||||
RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'
|
||||
PEPURL = 'pep-%04d.html'
|
||||
|
||||
PEPCVSURL = 'http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/peps/pep-%04d.txt'
|
||||
|
||||
|
||||
HOST = "shell.sourceforge.net" # host for update
|
||||
|
@ -158,11 +159,17 @@ def fixfile(infile, outfile):
|
|||
mailtos.append(addr)
|
||||
v = SPACE.join(mailtos)
|
||||
elif k.lower() in ('replaces', 'replaced-by'):
|
||||
peps = ''
|
||||
for pep in v.split():
|
||||
pep = int(pep)
|
||||
peps += '<a href="pep-%04d.html">%i</a> ' % (pep, pep)
|
||||
v = peps
|
||||
otherpeps = ''
|
||||
for otherpep in v.split():
|
||||
otherpep = int(otherpep)
|
||||
otherpeps += '<a href="pep-%04d.html">%i</a> ' % (otherpep,
|
||||
otherpep)
|
||||
v = otherpeps
|
||||
elif k.lower() in ('last-modified',):
|
||||
url = PEPCVSURL % int(pep)
|
||||
date = v or time.strftime('%d-%b-%Y',
|
||||
time.localtime(os.stat(infile)[8]))
|
||||
v = '<a href="%s">%s</a> ' % (url, cgi.escape(date))
|
||||
else:
|
||||
v = cgi.escape(v)
|
||||
print >> fo, ' <tr><th align="right">%s:</th><td>%s</td></tr>' % (
|
||||
|
|
Loading…
Reference in New Issue