From 113aaabcae0adc73d8d2fd42632ac78d62b95c8a Mon Sep 17 00:00:00 2001 From: Roger Light Date: Tue, 31 Dec 2013 22:37:43 +0000 Subject: [PATCH] Always return tuple in un/subscribe(). --- src/paho/mqtt/client.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index da188be..8798c9b 100755 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -883,11 +883,11 @@ class Client(object): qos: Not used. The function returns a tuple (result, mid), where result is - MQTT_ERR_SUCCESS to indicate success or MQTT_ERR_NO_CONN if the client - is not currently connected. mid is the message ID for the subscribe - request. The mid value can be used to track the subscribe request by - checking against the mid argument in the on_subscribe() callback if it - is defined. + MQTT_ERR_SUCCESS to indicate success or (MQTT_ERR_NO_CONN, None) if the + client is not currently connected. mid is the message ID for the + subscribe request. The mid value can be used to track the subscribe + request by checking against the mid argument in the on_subscribe() + callback if it is defined. Raises a ValueError if qos is not 0, 1 or 2, or if topic is None or has zero string length, or if topic is not a string, tuple or list. @@ -917,7 +917,7 @@ class Client(object): raise ValueError("No topic specified, or incorrect topic type.") if self._sock is None and self._ssl is None: - return MQTT_ERR_NO_CONN + return (MQTT_ERR_NO_CONN, None) return self._send_subscribe(False, topic_qos_list) @@ -928,8 +928,8 @@ class Client(object): topics to unsubscribe from. Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS - to indicate success or MQTT_ERR_NO_CONN if the client is not currently - connected. + to indicate success or (MQTT_ERR_NO_CONN, None) if the client is not + currently connected. mid is the message ID for the unsubscribe request. The mid value can be used to track the unsubscribe request by checking against the mid argument in the on_unsubscribe() callback if it is defined. @@ -954,7 +954,7 @@ class Client(object): raise ValueError("No topic specified, or incorrect topic type.") if self._sock is None and self._ssl is None: - return MQTT_ERR_NO_CONN + return (MQTT_ERR_NO_CONN, None) return self._send_unsubscribe(False, topic_list) -- 2.39.5