From 88613b869128d51145da3a27dd666b9c8cb3e30b Mon Sep 17 00:00:00 2001 From: Simeon Visser Date: Sun, 26 Apr 2015 05:33:43 +0100 Subject: [PATCH] Allow host:port strings to be specified as Unicode string --- gearman/compat.py | 2 ++ gearman/connection_manager.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gearman/compat.py b/gearman/compat.py index 37711e0..1f771b5 100644 --- a/gearman/compat.py +++ b/gearman/compat.py @@ -6,8 +6,10 @@ PY3 = sys.version_info[0] >= 3 if PY3: + basestring_type = str bytes_type = bytes else: + basestring_type = basestring bytes_type = str # Required for python2.4 backward compatibilty diff --git a/gearman/connection_manager.py b/gearman/connection_manager.py index 5356a10..345d2d1 100644 --- a/gearman/connection_manager.py +++ b/gearman/connection_manager.py @@ -61,7 +61,7 @@ def __init__(self, host_list=None): host_list = host_list or [] for element in host_list: # old style host:port pair - if isinstance(element, str): + if isinstance(element, compat.basestring_type): self.add_connection(element) elif isinstance(element, dict): if not all (k in element for k in ('host', 'port', 'keyfile', 'certfile', 'ca_certs')):