Skip to content
Snippets Groups Projects
Commit cd64dd93 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

py3

parent 35878952
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment