From ba766714ab58402b891699ef7c7c4705ee8237d6 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Mon, 31 Jan 2011 22:31:06 +0100 Subject: [PATCH] Ghettoq transport names are now aliases to the kombu ones --- Changelog | 6 ++++++ kombu/messaging.py | 3 ++- kombu/transport/__init__.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index f3e9be44..b4bb2b30 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,12 @@ 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 ===== diff --git a/kombu/messaging.py b/kombu/messaging.py index 48b814e4..17d09686 100644 --- a/kombu/messaging.py +++ b/kombu/messaging.py @@ -73,7 +73,8 @@ class Producer(object): self.auto_declare = auto_declare self.exchange = self.exchange(self.channel) - self.auto_declare and self.declare() + if self.auto_declare: + self.declare() if self.on_return: self.channel.events["basic_return"].append(self.on_return) diff --git a/kombu/transport/__init__.py b/kombu/transport/__init__.py index 0de6f4ca..a86498f7 100644 --- a/kombu/transport/__init__.py +++ b/kombu/transport/__init__.py @@ -47,6 +47,27 @@ def _sqlalchemy_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 = { "amqplib": "kombu.transport.pyamqplib.Transport", "librabbitmq": "kombu.transport.librabbitmq.Transport", @@ -59,6 +80,13 @@ TRANSPORT_ALIASES = { "couchdb": "kombu.transport.pycouchdb.Transport", "django": _django_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 = {}