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

@ -230,8 +230,8 @@ class ClassDescriptor(Descriptor):
'''Adds a new field to the Tool.'''
exec "self.modelClass.%s = fieldType" % fieldName
if fieldName in self.modelClass._appy_attributes:
print 'Warning, field "%s" is already existing on class "%s"' % \
(fieldName, self.modelClass.__name__)
print('Warning, field "%s" is already existing on class "%s"' % \
(fieldName, self.modelClass.__name__))
return
self.modelClass._appy_attributes.append(fieldName)
self.orderedAttributes.append(fieldName)

View file

@ -342,7 +342,7 @@ class Generator:
msg = ''
if self.totalNumberOfTests:
msg = ' (number of tests found: %d)' % self.totalNumberOfTests
print 'Done%s.' % msg
print('Done%s.' % msg)
# ------------------------------------------------------------------------------
class ZopeGenerator(Generator):
@ -427,8 +427,8 @@ class ZopeGenerator(Generator):
removedLabels = potFile.update(self.labels.get(),self.options.i18nClean,
not self.options.i18nSort)
if removedLabels:
print 'Warning: %d messages were removed from translation ' \
'files: %s' % (len(removedLabels), str(removedLabels))
print('Warning: %d messages were removed from translation ' \
'files: %s' % (len(removedLabels), str(removedLabels)))
# Before generating the POT file, we still need to add one label for
# every page for the Translation class. We've not done it yet because
# the number of pages depends on the total number of labels in the POT
@ -754,7 +754,7 @@ class ZopeGenerator(Generator):
'''Is called each time an Appy class is found in the application, for
generating the corresponding Archetype class.'''
k = classDescr.klass
print 'Generating %s.%s (gen-class)...' % (k.__module__, k.__name__)
print('Generating %s.%s (gen-class)...' % (k.__module__, k.__name__))
# Determine base Zope class
isFolder = classDescr.isFolder()
baseClass = isFolder and 'Folder' or 'SimpleItem'
@ -788,7 +788,7 @@ class ZopeGenerator(Generator):
'''This method creates the i18n labels related to the workflow described
by p_wfDescr.'''
k = wfDescr.klass
print 'Generating %s.%s (gen-workflow)...' % (k.__module__, k.__name__)
print('Generating %s.%s (gen-workflow)...' % (k.__module__, k.__name__))
# Identify workflow name
wfName = WorkflowDescriptor.getWorkflowName(wfDescr.klass)
# Add i18n messages for states

View file

@ -15,9 +15,9 @@ if covFolder:
cov = coverage()
cov.start()
except ImportError:
print 'COVERAGE KO! The "coverage" program is not installed. You can ' \
print('COVERAGE KO! The "coverage" program is not installed. You can ' \
'download it from http://nedbatchelder.com/code/coverage.' \
'\nHit <enter> to execute the test suite without coverage.'
'\nHit <enter> to execute the test suite without coverage.')
sys.stdin.readline()
def countTest():