From 419d08bee63c7237f828a5e0169abf76c84421e4 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Tue, 25 Oct 2011 22:16:27 +0100 Subject: [PATCH] str.encode does not accept kwargs in Py < 2.7. Closes #68. Thanks to mbudde --- kombu/transport/SQS.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kombu/transport/SQS.py b/kombu/transport/SQS.py index f9ee2c75..a17b13cd 100644 --- a/kombu/transport/SQS.py +++ b/kombu/transport/SQS.py @@ -25,6 +25,7 @@ from boto.sqs.message import Message from kombu.transport import virtual from kombu.utils import cached_property, uuid +from kombu.utils.encoding import safe_str # dots are replaced by dash, all other punctuation @@ -153,7 +154,7 @@ class Channel(virtual.Channel): def entity_name(self, name, table=CHARS_REPLACE_TABLE): """Format AMQP queue name into a legal SQS queue name.""" - return name.encode(errors="replace").translate(table) + return safe_str(name).translate(table) def _new_queue(self, queue, **kwargs): """Ensures a queue exists in SQS."""