transports: when transport is a tuple the second are keyword arguments for the constructor
This commit is contained in:
parent
5c3b40e738
commit
1c76a88d6b
|
@ -42,10 +42,14 @@ def get_transports():
|
|||
if __TRANSPORTS is None:
|
||||
transports = []
|
||||
for class_path in app_settings.transport_modes:
|
||||
if not isinstance(class_path, basestring):
|
||||
class_path, kwargs = class_path
|
||||
else:
|
||||
kwargs = {}
|
||||
module_path, class_name = class_path.rsplit('.', 1)
|
||||
try:
|
||||
module = import_module(module_path)
|
||||
transports.append(getattr(module, class_name)())
|
||||
transports.append(getattr(module, class_name)(**kwargs))
|
||||
except (ImportError, AttributeError), e:
|
||||
raise ImportError('Unable to load transport class %s' % class_path, e)
|
||||
__TRANSPORTS = transports
|
||||
|
|
Reference in New Issue