Use six.string_types for topic type check in #824
This commit is contained in:
@@ -133,7 +133,7 @@ class SubscriptionState(object):
|
|||||||
if self._user_assignment:
|
if self._user_assignment:
|
||||||
raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
|
raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
|
||||||
|
|
||||||
if isinstance(topics, str):
|
if isinstance(topics, six.string_types):
|
||||||
topics = [topics]
|
topics = [topics]
|
||||||
|
|
||||||
if self.subscription == set(topics):
|
if self.subscription == set(topics):
|
||||||
@@ -141,7 +141,7 @@ class SubscriptionState(object):
|
|||||||
topics)
|
topics)
|
||||||
return
|
return
|
||||||
|
|
||||||
if any(not isinstance(t, str) for t in topics):
|
if any(not isinstance(t, six.string_types) for t in topics):
|
||||||
raise TypeError('All topics must be strings')
|
raise TypeError('All topics must be strings')
|
||||||
|
|
||||||
log.info('Updating subscribed topics to: %s', topics)
|
log.info('Updating subscribed topics to: %s', topics)
|
||||||
|
Reference in New Issue
Block a user