def __init__(self, config): database = config['mongo_db_name'] if 'mongo_login' in config: passwordfile = config['mongo_login'] else: passwordfile = None connection = MongoDB.connect(config) Database.__init__(self, connection, database) if passwordfile is not None and exists(passwordfile): password = yaml.load(open(passwordfile, 'rU')) self.authenticate(password['mongo_user'], password['mongo_password'])
def __init__(self, connection, name, collections, *args, **kwargs): self._collections = collections Database.__init__(self, connection, name, *args, **kwargs)