-"Common WWW/CGI utilities"
+"""Common WWW/CGI utilities"""
+from __future__ import print_function
import sys, os
def exception(str = ""):
if sys.exc_type == SystemExit: # pass exit() normally
return
-
- print "Content-Type: text/html"
- print # Terminate HTTP headers
+
+ # Add the second linefeed to terminate HTTP headers
+ print("Content-Type: text/html\n")
import html
- print html.exception()
+ print(html.exception())
if str:
- print str
+ print(str)
sys.exit(1)
if not err_str:
err_str = "Unknown error"
- print "Content-Type: text/html"
- print # Terminate HTTP headers
+ # Add the second linefeed to terminate HTTP headers
+ print("Content-Type: text/html\n")
- print str(err_str)
+ print(str(err_str))
sys.exit(1)
def gen_html(title, body):
- print """
+ print("""
<HTML>
<HEAD>
<TITLE>
%s
</BODY>
</HTML>
- """ % (title, body)
+ """ % (title, body))
def mkexpires(hours=1, minutes=0, seconds=0):