diff options
author | Antonio Gutierrez <chibby0ne@gmail.com> | 2018-08-12 04:59:27 +0200 |
---|---|---|
committer | Asif Saifuddin Auvi <auvipy@gmail.com> | 2018-08-12 08:59:27 +0600 |
commit | 1160b92c27f2f6c56554663f0d6d4ad9194b3dff (patch) | |
tree | 7d8f9af08aaf176978b3031ec774033fbad3f31c /kombu/entity.py | |
parent | 073001e3419fa275eb34c5ca31a1bb5d7225b405 (diff) | |
download | kombu-1160b92c27f2f6c56554663f0d6d4ad9194b3dff.tar.gz |
Queue: add handling of Exchange as str to constructor (#904)
To fit with the documentation, Queue can now handle a str argument for
the exchange parameter in the constructor, as well as an actual Exchange
object.
Added relevant unit tests to avoid regressions.
Fixes: https://github.com/celery/kombu/issues/903
Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
Diffstat (limited to 'kombu/entity.py')
-rw-r--r-- | kombu/entity.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kombu/entity.py b/kombu/entity.py index bded8454..ccdeda2e 100644 --- a/kombu/entity.py +++ b/kombu/entity.py @@ -568,7 +568,10 @@ class Queue(MaybeChannelBound): **kwargs): super(Queue, self).__init__(**kwargs) self.name = name or self.name - self.exchange = exchange or self.exchange + if isinstance(exchange, str): + self.exchange = Exchange(exchange) + elif isinstance(exchange, Exchange): + self.exchange = exchange self.routing_key = routing_key or self.routing_key self.bindings = set(bindings or []) self.on_declared = on_declared |