Under Python 2.6, curly braces in strings to .format() MUST be indexed.

This commit is contained in:
Pedro Algarvio 2013-11-11 05:39:37 +00:00
parent a949e94aca
commit db02bfdfa2

View File

@ -58,7 +58,7 @@ if salt.utils.is_windows():
# The following imports are used by the namespaced win_pkg funcs
# and need to be included in their globals.
import msgpack
from distutils.version import LooseVersion # pylint: disable=E0611
from distutils.version import LooseVersion # pylint: disable=E0611,F0401
log = logging.getLogger(__name__)
@ -647,7 +647,8 @@ def latest(
comment += ' The following packages are already ' \
'up-to-date: {0}.'.format(', '.join(sorted(up_to_date)))
else:
comment += ' {} packages are already up-to-date.'.format(len(up_to_date))
comment += ' {0} packages are already up-to-date.'.format(
len(up_to_date))
return {'name': name,
'changes': {},
@ -687,7 +688,8 @@ def latest(
msg = 'The following packages were already up-to-date: ' \
'{0}.'.format(', '.join(sorted(up_to_date)))
else:
msg = '{} packages were already up-to-date. '.format(len(up_to_date))
msg = '{0} packages were already up-to-date. '.format(
len(up_to_date))
comments.append(msg)
return {'name': name,
@ -696,7 +698,7 @@ def latest(
'comment': ' '.join(comments)}
else:
if len(targets) > 10:
comment = 'All targeted {} packages failed to update.'\
comment = 'All targeted {0} packages failed to update.'\
.format(len(targets))
elif len(targets) > 1:
comment = 'All targeted packages failed to update: ' \
@ -710,7 +712,7 @@ def latest(
'up-to-date: ' \
'{0}'.format(', '.join(sorted(up_to_date)))
else:
comment += '{} packages were already ' \
comment += '{0} packages were already ' \
'up-to-date.'.format(len(up_to_date))
return {'name': name,
@ -719,7 +721,8 @@ def latest(
'comment': comment}
else:
if len(desired_pkgs) > 10:
comment = 'All {} packages are up-to-date.'.format(len(desired_pkgs))
comment = 'All {0} packages are up-to-date.'.format(
len(desired_pkgs))
elif len(desired_pkgs) > 1:
comment = 'All packages are up-to-date ' \
'({0}).'.format(', '.join(sorted(desired_pkgs)))