Ghettoq transport names are now aliases to the kombu ones

This commit is contained in:
Ask Solem 2011-01-31 22:31:06 +01:00
parent 5eac1a8643
commit ba766714ab
3 changed files with 36 additions and 1 deletions

View File

@ -2,6 +2,12 @@
Change history Change history
================ ================
1.0.2
=====
* amqplib: Message properties were not set properly.
* Ghettoq backend names are now automatically translated to the new names.
1.0.1 1.0.1
===== =====

View File

@ -73,7 +73,8 @@ class Producer(object):
self.auto_declare = auto_declare self.auto_declare = auto_declare
self.exchange = self.exchange(self.channel) self.exchange = self.exchange(self.channel)
self.auto_declare and self.declare() if self.auto_declare:
self.declare()
if self.on_return: if self.on_return:
self.channel.events["basic_return"].append(self.on_return) self.channel.events["basic_return"].append(self.on_return)

View File

@ -47,6 +47,27 @@ def _sqlalchemy_transport():
return "sqlakombu.transport.Transport" return "sqlakombu.transport.Transport"
def _ghettoq(name, new, alias=None):
xxx = new
def __inner():
import warnings
_new = callable(xxx) and xxx() or xxx
gtransport = "ghettoq.taproot.%s" % name
ktransport = "kombu.transport.%s.Transport" % _new
this = alias or name
warnings.warn("""
Ghettoq does not work with Kombu, but there is now a built-in version
of the %s transport.
You should replace %r with simply: %r
""" % (name, gtransport, this))
print("TTT: %r" % ktransport)
return ktransport
return __inner
TRANSPORT_ALIASES = { TRANSPORT_ALIASES = {
"amqplib": "kombu.transport.pyamqplib.Transport", "amqplib": "kombu.transport.pyamqplib.Transport",
"librabbitmq": "kombu.transport.librabbitmq.Transport", "librabbitmq": "kombu.transport.librabbitmq.Transport",
@ -59,6 +80,13 @@ TRANSPORT_ALIASES = {
"couchdb": "kombu.transport.pycouchdb.Transport", "couchdb": "kombu.transport.pycouchdb.Transport",
"django": _django_transport, "django": _django_transport,
"sqlalchemy": _sqlalchemy_transport, "sqlalchemy": _sqlalchemy_transport,
"ghettoq.taproot.Redis": _ghettoq("Redis", "pyredis", "redis"),
"ghettoq.taproot.Database": _ghettoq("Database", _django_transport,
"django"),
"ghettoq.taproot.MongoDB": _ghettoq("MongoDB", "mongodb"),
"ghettoq.taproot.Beanstalk": _ghettoq("Beanstalk", "beanstalk"),
"ghettoq.taproot.CouchDB": _ghettoq("CouchDB", "couchdb"),
} }
_transport_cache = {} _transport_cache = {}