Commit 0474ba5b authored by Vincent Pelletier's avatar Vincent Pelletier

Make connector.getConnectorHandler accept None values (returns the default connector).

Make "connector" parameter of client's Sotrage and Application classes optional.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1255 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bd9aaa8f
......@@ -26,7 +26,8 @@ class Storage(BaseStorage.BaseStorage,
__name__ = 'NEOStorage'
def __init__(self, master_nodes, name, connector, read_only=False, **kw):
def __init__(self, master_nodes, name, connector=None, read_only=False,
**kw):
BaseStorage.BaseStorage.__init__(self, name)
self._is_read_only = read_only
self.app = Application(master_nodes, name, connector)
......
......@@ -232,7 +232,7 @@ class ThreadContext(object):
class Application(object):
"""The client node application."""
def __init__(self, master_nodes, name, connector, **kw):
def __init__(self, master_nodes, name, connector=None, **kw):
# XXX: use a configuration entry
em = EventManager()
# Start polling thread
......
......@@ -23,11 +23,14 @@ from neo import logging
# Fill by calling registerConnectorHandler.
# Read by calling getConnectorHandler.
connector_registry = {}
DEFAULT_CONNECTOR = 'SocketConnector'
def registerConnectorHandler(connector_handler):
connector_registry[connector_handler.__name__] = connector_handler
def getConnectorHandler(connector):
def getConnectorHandler(connector=None):
if connector is None:
connector = DEFAULT_CONNECTOR
if isinstance(connector, basestring):
connector_handler = connector_registry.get(connector)
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment