Queue.consume: Ensure consumer_tag is not None, it must be empty string for the server to generate a tag. Closes #21

This commit is contained in:
Ask Solem 2011-03-28 14:45:44 +02:00
parent af4339170d
commit fafcc732d5
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,12 @@
* Redis did not respect QoS settings.
* consumer_tag argument to ``Queue.consume`` can't be :const:`None`
(Issue #21).
A None value is now automatically converted to empty string.
An empty string will make the server generate a unique tag.
* BrokerConnection now supports a ``transport_options`` argument.
This can be used to pass additional arguments to transports.

View File

@ -415,7 +415,7 @@ class Queue(MaybeChannelBound):
return _SYN(self.channel.queue_purge, queue=self.name,
nowait=nowait) or 0
def consume(self, consumer_tag=None, callback=None, no_ack=None,
def consume(self, consumer_tag='', callback=None, no_ack=None,
nowait=False):
"""Start a queue consumer.
@ -437,7 +437,7 @@ class Queue(MaybeChannelBound):
"""
return self.channel.basic_consume(queue=self.name,
no_ack=no_ack,
consumer_tag=consumer_tag,
consumer_tag=consumer_tag or '',
callback=callback,
nowait=nowait)