From 50643b0f0e84ee8dead6a00a5508f0b30ca9103b Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Sun, 29 Jan 2017 21:00:38 +0100 Subject: [PATCH] v0.89 --- README.md | 5 ++--- coolamqp/objects.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3306acc..719741f 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,6 @@ if you need every CPU cycle you can get. * Consumer being cancelled with a CCN * v0.88: - * **API changes:** - * Cluster.start will RuntimeError if called more than once - * Cluster.shutdown will RuntimeError if called without .start + * Cluster.start will RuntimeError if called more than once + * Cluster.shutdown will RuntimeError if called without .start * Warning with content list is shorter diff --git a/coolamqp/objects.py b/coolamqp/objects.py index bb6e165..837ac4f 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -72,7 +72,8 @@ class Message(object): self.properties = properties -LAMBDA_NONE = lambda: None +def LAMBDA_NONE(): + pass class ReceivedMessage(Message): @@ -125,7 +126,16 @@ class Exchange(object): direct = None # the direct exchange def __init__(self, name=u'', type=b'direct', durable=True, auto_delete=False): + """ + :type name: unicode is preferred, binary type will get decoded to unicode with utf8 + :param type: exchange type. Please pass a binary type. + """ + + if isinstance(name, six.binary_type): + name = name.decode('utf8') + self.name = name + if isinstance(type, six.text_type): type = type.encode('utf8') warnings.warn(u'type should be a binary type') @@ -135,7 +145,7 @@ class Exchange(object): def __repr__(self): return u'Exchange(%s, %s, %s, %s)' % ( - repr(self.name), repr(self.type), repr(self.durable), repr(self.auto_delete)) + repr(self.name), repr(self.type), repr(self.durable), repr(self.auto_delete)) def __hash__(self): return self.name.__hash__() -- GitLab