docs: Adds Custom broker class documentation

Also changes some of the variable and settings names, to make them less ambiguous.
This commit is contained in:
Ilan Steemers
2016-01-27 12:06:49 +01:00
parent 3ac7f26de5
commit c17468ef86
5 changed files with 53 additions and 6 deletions
+2 -2
View File
@@ -159,8 +159,8 @@ def get_broker(list_key=Conf.PREFIX):
:return:
"""
# custom
if Conf.BROKER:
module, func = Conf.BROKER.rsplit('.', 1)
if Conf.BROKER_CLASS:
module, func = Conf.BROKER_CLASS.rsplit('.', 1)
m = importlib.import_module(module)
broker = getattr(m, func)
return broker(list_key=list)
+2 -2
View File
@@ -51,8 +51,8 @@ class Conf(object):
# ORM broker
ORM = conf.get('orm', None)
# Custom broker
BROKER = conf.get('broker', None)
# Custom broker class
BROKER_CLASS = conf.get('broker_class', None)
# Database Poll
POLL = conf.get('poll', 0.2)
+2 -2
View File
@@ -50,12 +50,12 @@ def test_redis():
def test_custom():
Conf.BROKER = 'brokers.redis_broker.Redis'
Conf.BROKER_CLASS = 'brokers.redis_broker.Redis'
broker = get_broker()
assert broker.ping() is True
assert broker.info() is not None
assert broker.__class__.__name__ == 'Redis'
Conf.BROKER = None
Conf.BROKER_CLASS = None
def test_disque():