From 46bd38757b7a149baa4f15ee6be3fe6e63a2dd2a Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Sat, 31 Jul 2010 14:25:53 +0200 Subject: [PATCH] amqplib backend: Properly support Message.properties + Message.headers --- kombu/backends/pyamqplib.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/kombu/backends/pyamqplib.py b/kombu/backends/pyamqplib.py index 87361dc2..944069af 100644 --- a/kombu/backends/pyamqplib.py +++ b/kombu/backends/pyamqplib.py @@ -112,17 +112,16 @@ class Message(BaseMessage): """ - def __init__(self, channel, amqp_message, **kwargs): - self.channel = channel - - for attr_name in ("body", - "delivery_tag", - "content_type", - "content_encoding", - "delivery_info"): - kwargs[attr_name] = getattr(amqp_message, attr_name, None) - - super(Message, self).__init__(channel, **kwargs) + def __init__(self, channel, msg, **kwargs): + super(Message, self).__init__(channel, + body=msg.body, + delivery_tag=msg.delivery_tag, + content_type=msg.content_type, + content_encoding=msg.content_encoding, + delivery_info=msg.delivery_info, + properties=msg.properties, + headers=msg.application_headers, + **kwargs) class Channel(Channel): @@ -140,7 +139,7 @@ class Channel(Channel): def message_to_python(self, raw_message): """Convert encoded message body back to a Python value.""" - return self.Message(channel=self, amqp_message=raw_message) + return self.Message(self, raw_message) class Backend(BaseBackend):