diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py index 9d170b17679ab9a694c4078b3b73d60422a55e93..72fa3fd4961a35754f3066f1d12d771d720a17a7 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 9551695245acaa8f62871a3f89b5a08e67fe1457..552c06394fb8c324980acb32fe358fc6d27331f9 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')