Skip to content

Commit

Permalink
Carrot compat interface now working with celery
Browse files Browse the repository at this point in the history
  • Loading branch information
Ask Solem committed Jul 20, 2010
1 parent 58e0c08 commit 90eaf27
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions kombu/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def entry_to_binding(queue, **options):
e_auto_delete = options.get("exchange_auto_delete") or \
options.get("auto_delete")
q_durable = options.get("queue_durable") or options.get("durable")
q_auto_delete = options.get("queue_auto_delete") or
q_auto_delete = options.get("queue_auto_delete") or \
options.get("auto_delete")
e_arguments = options.get("exchange_arguments")
q_arguments = options.get("queue_arguments")
Expand All @@ -29,7 +29,7 @@ def entry_to_binding(queue, **options):
routing_key=options.get("routing_key"),
durable=e_durable,
auto_delete=e_auto_delete,
arguments=e_arguments,
arguments=e_arguments)
return entity.Binding(queue,
exchange=exchange,
routing_key=binding_key,
Expand Down Expand Up @@ -72,7 +72,7 @@ def __init__(self, connection, exchange=None, routing_key=None,
super(Publisher, self).__init__(self.backend, self.exchange,
**kwargs)

def send(*args, **kwargs):
def send(self, *args, **kwargs):
return self.publish(*args, **kwargs)

def close(self):
Expand Down Expand Up @@ -183,7 +183,7 @@ def __init__(self, connection, *args, **kwargs):
super(_CSet, self).__init__(self.backend, *args, **kwargs)

def iterconsume(self):
raise iterconsume(self.connection, self)
return iterconsume(self.connection, self)

def add_consumer_from_dict(self, queue, **options):
self.bindings.append(entry_to_binding(queue, **options))
Expand All @@ -197,12 +197,13 @@ def close(self):


def ConsumerSet(connection, from_dict=None, consumers=None,
callbacks=None, **options):
callbacks=None, **kwargs):

bindings = []
for consumer in consumers:
bindings.extend(consumer.bindings)
for queue, options in from_dict.items():
bindings.append(entry_to_binding(queue, **options))
if consumers:
map(bindings.extend, consumer.bindings)
if from_dict:
for queue_name, queue_options in from_dict.items():
bindings.append(entry_to_binding(queue_name, **queue_options))

return _CSet(connection, bindings, **options)
return _CSet(connection, bindings, **kwargs)

0 comments on commit 90eaf27

Please sign in to comment.