Fix some problem with class attribute and property

This commit is contained in:
Sylvain Bellemare 2016-12-13 11:45:41 +01:00
parent 1f996c1746
commit 14d5564349

View File

@ -11,19 +11,19 @@ logger = logging.getLogger(__name__)
class MongoDBConnection(Connection):
def __init__(self, host=None, port=None, db=None, max_tries=3):
def __init__(self, host=None, port=None, dbname=None, max_tries=3):
"""Create a new Connection instance.
Args:
host (str, optional): the host to connect to.
port (int, optional): the port to connect to.
db (str, optional): the database to use.
dbname (str, optional): the database to use.
max_tries (int, optional): how many tries before giving up.
"""
self.host = host or bigchaindb.config['database']['host']
self.port = port or bigchaindb.config['database']['port']
self.db = db or bigchaindb.config['database']['name']
self.dbname = dbname or bigchaindb.config['database']['name']
self.max_tries = max_tries
self.conn = None
@ -33,7 +33,7 @@ class MongoDBConnection(Connection):
self._connect()
else:
return self.conn[self.db]
return self.conn[self.dbname]
def _connect(self):
for i in range(self.max_tries):