Updated 'print' statements throughout Appy code, in order to be Python3x as well as Python2x-compliant.

This commit is contained in:
Gaetan Delannay 2013-05-30 00:46:11 +02:00
parent e8c63f225f
commit 0c50fe188a
24 changed files with 92 additions and 92 deletions

View file

@ -31,6 +31,7 @@ XHTML_UNSTYLABLE_TAGS = XHTML_LISTS + ('li', 'a')
# ------------------------------------------------------------------------------
class PodError(Exception):
@staticmethod
def dumpTraceback(buffer, tb, textNs, removeFirstLine):
if removeFirstLine:
# This error came from an exception raised by pod. The text of the
@ -46,11 +47,13 @@ class PodError(Exception):
buffer.write('<%s:p>' % textNs)
try:
buffer.dumpContent(tLine)
except UnicodeDecodeError, ude:
except UnicodeDecodeError:
buffer.dumpContent(tLine.decode('utf-8'))
buffer.write('</%s:p>' % textNs)
dumpTraceback = staticmethod(dumpTraceback)
def dump(buffer, message, withinElement=None, removeFirstLine=False, dumpTb=True):
@staticmethod
def dump(buffer, message, withinElement=None, removeFirstLine=False,
dumpTb=True):
'''Dumps the error p_message in p_buffer.'''
# Define some handful shortcuts
e = buffer.env
@ -80,7 +83,6 @@ class PodError(Exception):
for subTag in subTags:
buffer.write('</%s>' % subTag.elem)
buffer.write('</%s>' % withinElement.OD.elem)
dump = staticmethod(dump)
# XXX To remove, present for backward compatibility only.
convertToXhtml = escapeXhtml

View file

@ -491,7 +491,7 @@ class Renderer:
# an ODT or ODS to return to the user. So we produce a warning
# instead of raising an error.
if (resultType in self.templateTypes) and self.forceOoCall:
print WARNING_INCOMPLETE_OD % str(pe)
print(WARNING_INCOMPLETE_OD % str(pe))
else:
raise pe
return loOutput
@ -535,7 +535,7 @@ class Renderer:
try:
self.finalizeFunction(self.unzipFolder)
except Exception, e:
print WARNING_FINALIZE_ERROR % str(e)
print(WARNING_FINALIZE_ERROR % str(e))
# Re-zip the result, first as an OpenDocument file of the same type as
# the POD template (odt, ods...)
resultExt = self.getTemplateType()

View file

@ -134,7 +134,7 @@ class Test(appy.shared.test.Test):
#tempFolder2 = '%s/sevResults' % self.testFolder
#if not os.path.exists(tempFolder2):
# os.mkdir(tempFolder2)
#print 'Result is', self.result, 'temp folder 2 is', tempFolder2
#print('Result is %s, temp folder 2 is %s.' % (self.result,tempFolder2))
#shutil.copy(self.result, tempFolder2)
def getOdtContent(self, odtFile):