def init(scope, settings): cfg = settings.get('rwdb', {}) connections = [] keys = [] for key, client_attr in cfg.items(): # populate defaults for default_key in ['host', 'db', 'user', 'password']: if default_key in cfg and not default_key in client_attr: client_attr[default_key] = cfg['default'][default_key] keys.append(key) connections.append(connect(client_attr)) connections = yield connections clients = dict(zip(keys, connections)) databases = {key: clients[key][cfg[key]['db']] for key in keys} scope['rwdb:clients'] = clients scope['rwdb:databases'] = databases scope.setdefault('rw.routing:converters', {}).update({'ObjectId': routing_converter_object_id})
def init(scope): scope.setdefault('rw.routing:converters', {}).update({ 'str': converter_default, 'int': converter_int, 'uint': converter_uint, 'path': converter_path })
def init(scope, settings): cfg = settings.get('rwdb', {}) connections = [] keys = [] for key, client_attr in cfg.items(): # populate defaults for default_key in ['host', 'db', 'user', 'password']: if default_key in cfg and not default_key in client_attr: client_attr[default_key] = cfg['default'][default_key] keys.append(key) connections.append(connect(client_attr)) connections = yield connections clients = dict(zip(keys, connections)) databases = { key: clients[key][cfg[key]['db']] for key in keys } scope['rwdb:clients'] = clients scope['rwdb:databases'] = databases scope.setdefault('rw.routing:converters', {}).update({ 'ObjectId': routing_converter_object_id })