From be19ed77ddb047e02fe94d142181062af6d99dcc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 9 Feb 2007 05:37:30 +0000 Subject: Fix most trivially-findable print statements. There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.) --- Lib/cgi.py | 70 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'Lib/cgi.py') diff --git a/Lib/cgi.py b/Lib/cgi.py index 0cc5fad82aa..5ddf16e8f88 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -901,8 +901,8 @@ def test(environ=os.environ): the script in HTML form. """ - print "Content-type: text/html" - print + print("Content-type: text/html") + print() sys.stderr = sys.stdout try: form = FieldStorage() # Replace with other classes to test those @@ -915,12 +915,12 @@ def test(environ=os.environ): exec("testing print_exception() -- italics?") def g(f=f): f() - print "

What follows is a test, not an actual exception:

" + print("

What follows is a test, not an actual exception:

") g() except: print_exception() - print "

Second try with a small maxlen...

" + print("

Second try with a small maxlen...

") global maxlen maxlen = 50 @@ -937,67 +937,67 @@ def print_exception(type=None, value=None, tb=None, limit=None): if type is None: type, value, tb = sys.exc_info() import traceback - print - print "

Traceback (most recent call last):

" + print() + print("

Traceback (most recent call last):

") list = traceback.format_tb(tb, limit) + \ traceback.format_exception_only(type, value) - print "
%s%s
" % ( + print("
%s%s
" % ( escape("".join(list[:-1])), escape(list[-1]), - ) + )) del tb def print_environ(environ=os.environ): """Dump the shell environment as HTML.""" keys = environ.keys() keys.sort() - print - print "

Shell Environment:

" - print "
" + print() + print("

Shell Environment:

") + print("
") for key in keys: - print "
", escape(key), "
", escape(environ[key]) - print "
" - print + print("
", escape(key), "
", escape(environ[key])) + print("
") + print() def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() - print - print "

Form Contents:

" + print() + print("

Form Contents:

") if not keys: - print "

No form fields." - print "

" + print("

No form fields.") + print("

") for key in keys: - print "
" + escape(key) + ":", + print("
" + escape(key) + ":", end=' ') value = form[key] - print "" + escape(repr(type(value))) + "" - print "
" + escape(repr(value)) - print "
" - print + print("" + escape(repr(type(value))) + "") + print("
" + escape(repr(value))) + print("
") + print() def print_directory(): """Dump the current directory as HTML.""" - print - print "

Current Working Directory:

" + print() + print("

Current Working Directory:

") try: pwd = os.getcwd() except os.error as msg: - print "os.error:", escape(str(msg)) + print("os.error:", escape(str(msg))) else: - print escape(pwd) - print + print(escape(pwd)) + print() def print_arguments(): - print - print "

Command Line Arguments:

" - print - print sys.argv - print + print() + print("

Command Line Arguments:

") + print() + print(sys.argv) + print() def print_environ_usage(): """Dump a list of environment variables used by CGI as HTML.""" - print """ + print("""

These environment variables could have been set:

-""" +""") # Utilities -- cgit v1.2.3