From cd64dd9336b64bf84bc3de38088224dbcceec845 Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Tue, 10 Jan 2017 03:58:52 +0100 Subject: [PATCH] py3 --- coolamqp/clustering/cluster.py | 9 ++++----- coolamqp/framing/compilation/content_property.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py index 9d170b1..72fa3fd 100644 --- a/coolamqp/clustering/cluster.py +++ b/coolamqp/clustering/cluster.py @@ -92,18 +92,17 @@ class Cluster(object): :param tx: Whether to publish it transactionally. If you choose so, you will receive a Future that can be used to check it broker took responsibility for this message. + Note that if tx if False, and message cannot be delivered to broker at once, + it will be discarded. :return: Future or None """ - - publisher = (self.pub_tr if tx else self.pub_na) - if isinstance(exchange, Exchange): exchange = exchange.name try: - return publisher.publish(message, exchange.encode('utf8'), routing_key.encode('utf8')) + return (self.pub_tr if tx else self.pub_na).publish(message, exchange.encode('utf8'), routing_key.encode('utf8')) except Publisher.UnusablePublisher: - raise NotImplementedError(u'Sorry, this functionality if not yet implemented!') + raise NotImplementedError(u'Sorry, this functionality is not yet implemented!') def start(self, wait=True): diff --git a/coolamqp/framing/compilation/content_property.py b/coolamqp/framing/compilation/content_property.py index 9551695..552c063 100644 --- a/coolamqp/framing/compilation/content_property.py +++ b/coolamqp/framing/compilation/content_property.py @@ -89,8 +89,8 @@ def _compile_particular_content_property_list_class(zpf, fields): mod.append(u'\n def write_to(self, buf):\n') mod.append(u' buf.write(') repred_zpf = repr(zpf) - if not zpf.startswith(b'b'): - repred_zpf = 'b' + repred_zpf + if not zpf.startswith(u'b'): + repred_zpf = u'b' + repred_zpf mod.append(repred_zpf) mod.append(u')\n') -- GitLab