From c1665ac7aa598739b77fc46e5877ac497c550bc4 Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Thu, 12 Jan 2017 15:21:37 +0100 Subject: [PATCH] py3 --- coolamqp/attaches/consumer.py | 2 +- coolamqp/objects.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/coolamqp/attaches/consumer.py b/coolamqp/attaches/consumer.py index f0da62e..c6f2087 100644 --- a/coolamqp/attaches/consumer.py +++ b/coolamqp/attaches/consumer.py @@ -249,7 +249,7 @@ class Consumer(Channeler): self.connection.method_and_watch( self.channel_id, ExchangeDeclare(self.queue.exchange.name.encode('utf8'), - self.queue.exchange.type.encode('utf8'), + self.queue.exchange.type, False, self.queue.exchange.durable, self.queue.exchange.auto_delete, diff --git a/coolamqp/objects.py b/coolamqp/objects.py index 9f86359..4cb5f97 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -126,9 +126,11 @@ class Exchange(object): direct = None # the direct exchange - def __init__(self, name=u'', type='direct', durable=True, auto_delete=False): + def __init__(self, name=u'', type=b'direct', durable=True, auto_delete=False): self.name = name - self.type = type + if isinstance(type, six.text_type): + type = type.encode('utf8') + self.type = type # must be bytes self.durable = durable self.auto_delete = auto_delete -- GitLab