mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix some problem with class attribute and property
This commit is contained in:
parent
1f996c1746
commit
14d5564349
@ -11,19 +11,19 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class MongoDBConnection(Connection):
|
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.
|
"""Create a new Connection instance.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
host (str, optional): the host to connect to.
|
host (str, optional): the host to connect to.
|
||||||
port (int, optional): the port 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.
|
max_tries (int, optional): how many tries before giving up.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.host = host or bigchaindb.config['database']['host']
|
self.host = host or bigchaindb.config['database']['host']
|
||||||
self.port = port or bigchaindb.config['database']['port']
|
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.max_tries = max_tries
|
||||||
self.conn = None
|
self.conn = None
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class MongoDBConnection(Connection):
|
|||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return self.conn[self.db]
|
return self.conn[self.dbname]
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
for i in range(self.max_tries):
|
for i in range(self.max_tries):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user