Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replaced smart_text with smart_str
  • Loading branch information
Anton-Shutik committed Feb 6, 2024
commit 53f608a33e2b1503afb398e8953e156a68aeb2ba
12 changes: 6 additions & 6 deletions django_elasticache/cluster_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
utils for discovery cluster
"""
from distutils.version import StrictVersion
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
import re
from telnetlib import Telnet

Expand Down Expand Up @@ -35,7 +35,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
if len(version_list) not in [2, 3] or version_list[0] != b'VERSION':
raise WrongProtocolData('version', res)
version = version_list[1]
if StrictVersion(smart_text(version)) >= StrictVersion('1.4.14'):
if StrictVersion(smart_str(version)) >= StrictVersion('1.4.14'):
cmd = b'config get cluster\n'
else:
cmd = b'get AmazonElastiCache:cluster\n'
Expand All @@ -50,8 +50,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
return {
'version': version,
'nodes': [
'{0}:{1}'.format(smart_text(host),
smart_text(port))
'{0}:{1}'.format(smart_str(host),
smart_str(port))
]
}

Expand All @@ -67,8 +67,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
try:
for node in ls[2].split(b' '):
host, ip, port = node.split(b'|')
nodes.append('{0}:{1}'.format(smart_text(ip or host),
smart_text(port)))
nodes.append('{0}:{1}'.format(smart_str(ip or host),
smart_str(port)))
except ValueError:
raise WrongProtocolData(cmd, res)
return {
Expand Down