5 def print_environ(environ
=os
.environ
):
6 """Dump the shell environment as HTML."""
11 if not re
.search("^HTTP_|^REQUEST_", key
):
14 print """<tr class="normal"><td>""", escape(key
), "</td><td>", escape(environ
[key
]), "</td></tr>"
17 print """<tr class="alt"><td>""", escape(key
), "</td><td>", escape(environ
[key
]), "</td></tr>"
20 def escape(s
, quote
=None):
21 """Replace special characters '&', '<' and '>' by SGML entities."""
22 s
= s
.replace("&", "&") # Must be done first!
23 s
= s
.replace("<", "<")
24 s
= s
.replace(">", ">")
26 s
= s
.replace('"', """)
30 print """Content-type: text/html
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
36 <link rel="stylesheet" type="text/css" href="../../css/style.css">
39 <table cellspacing="0" cellpadding="0" border="0">
40 <tr class="subhead" align="Left"><th>Name</th><th>Value</th></tr>"""