Merge pull request #2 from tomgalloway/santiago

Avoid creating null listeners/senders/monitors.
This commit is contained in:
Nick Daly 2012-06-12 17:38:59 -07:00
commit 200357b1ff

View File

@ -93,7 +93,7 @@ class Santiago(object):
CONTROLLER_MODULE = "protocols.{0}.controller" CONTROLLER_MODULE = "protocols.{0}.controller"
def __init__(self, listeners = None, senders = None, def __init__(self, listeners = None, senders = None,
hosting = None, consuming = None, me = 0, monitors = None): hosting = None, consuming = None, me = 0, monitors = None, require_gpg = 0):
"""Create a Santiago with the specified parameters. """Create a Santiago with the specified parameters.
listeners and senders are both protocol-specific dictionaries containing listeners and senders are both protocol-specific dictionaries containing
@ -123,8 +123,11 @@ class Santiago(object):
self.gpg = gnupg.GPG(use_agent = True) self.gpg = gnupg.GPG(use_agent = True)
self.protocols = set() self.protocols = set()
if listeners is not None:
self.listeners = self.create_connectors(listeners, "Listener") self.listeners = self.create_connectors(listeners, "Listener")
if senders is not None:
self.senders = self.create_connectors(senders, "Sender") self.senders = self.create_connectors(senders, "Sender")
if monitors is not None:
self.monitors = self.create_connectors(monitors, "Monitor") self.monitors = self.create_connectors(monitors, "Monitor")
self.shelf = shelve.open(str(self.me)) self.shelf = shelve.open(str(self.me))