ask/kombu — pull request #82 by dahlia (2011-11-15 14:42:03+00:00)
Title: Proper handling of SQS queue name format

Unlike [`str.translate()`][1] method `unicode.translate()` method cannot take table encoded by [`string.maketrans()`][2] function. So I replaced `CHARS_REPLACE_TABLE` with a `dict` table of Unicode ordinals.

Before patched this, it could occur error like following in some cases:

Traceback (most recent call last):
File "/Users/dahlia/Projects/styleshare-env/lib/python2.7/site-packages/gevent-0.13.6-py2.7-macosx-10.7-intel.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/Users/dahlia/Projects/styleshare-env/lib/python2.7/site-packages/kombu-1.4.3-py2.7.egg/kombu/transport/virtual/__init__.py", line 359, in queue_declare
self._new_queue(queue, **kwargs)
File "/Users/dahlia/Projects/styleshare-env/lib/python2.7/site-packages/kombu-1.4.3-py2.7.egg/kombu/transport/SQS.py", line 165, in _new_queue
self.entity_name(queue),
File "/Users/dahlia/Projects/styleshare-env/lib/python2.7/site-packages/kombu-1.4.3-py2.7.egg/kombu/transport/SQS.py", line 157, in entity_name
return safe_str(name).translate(table)
TypeError: character mapping must return integer, None or unicode

[1]: http://docs.python.org/library/stdtypes.html#str.translate
[2]: http://docs.python.org/library/string.html#string.maketrans