Use print function instead of print statement

svn: r15271
This commit is contained in:
Gerald Britton 2010-04-22 19:41:48 +00:00
parent 5a7c72338f
commit 8cecd15dab
3 changed files with 12 additions and 17 deletions

View File

@ -26,6 +26,8 @@
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from __future__ import print_function
""" """
HTML operations. HTML operations.
@ -95,18 +97,6 @@ _START_CLOSE = set([
'param' 'param'
]) ])
#------------------------------------------------------------------------
#
# Helper functions.
#
#------------------------------------------------------------------------
def print_(line):
"""
Print function
"""
print line
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Html class. # Html class.
@ -383,7 +373,7 @@ class Html(list):
# #
iterkeys = itervalues = iteritems = __iter__ iterkeys = itervalues = iteritems = __iter__
# #
def write(self, method=print_, indent='\t', tabs=''): def write(self, method=print, indent='\t', tabs=''):
""" """
Output function: performs an insertion-order tree traversal Output function: performs an insertion-order tree traversal
and calls supplied method for each item found. and calls supplied method for each item found.

View File

@ -37,6 +37,8 @@ Narrative Web Page generator.
# python modules # python modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from __future__ print_function
from functools import partial
import gc import gc
import os import os
import sys import sys
@ -1861,7 +1863,7 @@ class BasePage(object):
src/plugins/lib/libhtml.py src/plugins/lib/libhtml.py
""" """
htmlinstance.write(lambda line: of.write(line + '\n')) htmlinstance.write(partial(print, file=of))
# closes the file # closes the file
self.report.close_file(of) self.report.close_file(of)
@ -5640,8 +5642,8 @@ class NavWebReport(Report):
try: try:
shutil.copyfile(from_fname, dest) shutil.copyfile(from_fname, dest)
except: except:
print "Copying error: %s" % sys.exc_info()[1] print("Copying error: %s" % sys.exc_info()[1])
print "Continuing..." print("Continuing...")
elif self.warn_dir: elif self.warn_dir:
WarningDialog( WarningDialog(
_("Possible destination error") + "\n" + _("Possible destination error") + "\n" +

View File

@ -27,9 +27,12 @@
""" """
Web Calendar generator. Web Calendar generator.
""" """
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# python modules # python modules
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from __future__ import print_function
from functools import partial
import os, codecs, shutil, re import os, codecs, shutil, re
import datetime, calendar import datetime, calendar
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
@ -1241,7 +1244,7 @@ class WebCalReport(Report):
""" """
# writes the file out from the page variable; Html instance # writes the file out from the page variable; Html instance
page.write(lambda line: of.write(line + '\n')) page.write(partial(print, file=of.write))
# close the file now... # close the file now...
self.close_file(of) self.close_file(of)