Skip to content

Commit 8abcf3a

Browse files
author
Peter Turi
committed
Make format calls python2.6 compatible
Automatic numbering of {} clauses inside the format call were only introduced into python2.7. This change allows for running on python2.6 for gradual modernization projects.
1 parent b8d3dfb commit 8abcf3a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

django_elasticache/cluster_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class WrongProtocolData(ValueError):
1414
"""
1515
def __init__(self, cmd, response):
1616
super(WrongProtocolData, self).__init__(
17-
'Unexpected response {} for command {}'.format(response, cmd))
17+
'Unexpected response {0} for command {1}'.format(response, cmd))
1818

1919

2020
def get_cluster_info(host, port, ignore_cluster_errors=False):
@@ -50,7 +50,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
5050
return {
5151
'version': version,
5252
'nodes': [
53-
'{}:{}'.format(smart_text(host),
53+
'{0}:{1}'.format(smart_text(host),
5454
smart_text(port))
5555
]
5656
}
@@ -67,7 +67,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
6767
try:
6868
for node in ls[2].split(b' '):
6969
host, ip, port = node.split(b'|')
70-
nodes.append('{}:{}'.format(smart_text(ip or host),
70+
nodes.append('{0}:{1}'.format(smart_text(ip or host),
7171
smart_text(port)))
7272
except ValueError:
7373
raise WrongProtocolData(cmd, res)

django_elasticache/memcached.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get_cluster_nodes(self):
7373
get_cluster_info(server, port,
7474
self._ignore_cluster_errors)['nodes'])
7575
except (socket.gaierror, socket.timeout) as err:
76-
raise Exception('Cannot connect to cluster {} ({})'.format(
76+
raise Exception('Cannot connect to cluster {0} ({1})'.format(
7777
self._servers[0], err
7878
))
7979
return self._cluster_nodes_cache

0 commit comments

Comments
 (0)