diff --git a/README.md b/README.md index 3306acc25ff1fc67a0d4410cd338c2842fddcfa0..719741f7abb7b17f0cf8b9f2ed672793810fee09 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 bb6e1658a49f02e3411f2eee51560e839fc62229..837ac4f270ba6817b6ad53cc51f365fca4c4cd41 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__()