|
@@ -32,29 +32,10 @@ class MigrationHandler(object):
|
32
|
32
|
## @brief Constructs a MongoDbMigrationHandler
|
33
|
33
|
# @param conn_args dict : a dictionary containing the connection options
|
34
|
34
|
# @param **kwargs : extra arguments
|
35
|
|
- def __init__(self, **kwargs):
|
36
|
|
-
|
37
|
|
- conn_args = dict()
|
38
|
|
- if 'host' in kwargs:
|
39
|
|
- conn_args['host'] = kwargs['host']
|
40
|
|
- if 'port' in kwargs:
|
41
|
|
- conn_args['port'] = kwargs['port']
|
42
|
|
- if 'db_name' in kwargs:
|
43
|
|
- conn_args['db_name'] = kwargs['db_name']
|
44
|
|
- if 'username' in kwargs:
|
45
|
|
- conn_args['username'] = kwargs['username']
|
46
|
|
- if 'password' in kwargs:
|
47
|
|
- conn_args['password'] = kwargs['password']
|
|
35
|
+ def __init__(self, host, port, db_name, username, password, **kwargs):
|
|
36
|
+ conn_args = {'host': host, 'port': port, 'db_name': db_name,
|
|
37
|
+ 'username': username, 'password': password}
|
48
|
38
|
|
49
|
|
- if len(conn_args.keys()) == 0:
|
50
|
|
- conn_args = get_connection_args()
|
51
|
|
- if len(conn_args.keys()) == 0:
|
52
|
|
- raise MigrationHandlerError("No connection arguments were given")
|
53
|
|
-
|
54
|
|
- if 'host' not in conn_args.keys() or 'port' not in conn_args.keys() or 'db_name' not in conn_args.keys() \
|
55
|
|
- or 'username' not in conn_args.keys() or 'password' not in conn_args.keys():
|
56
|
|
- raise MigrationHandlerError("Missing connection arguments")
|
57
|
|
-
|
58
|
39
|
self.database = connect(host=conn_args['host'], port=conn_args['port'], db_name=conn_args['db_name'],
|
59
|
40
|
username=conn_args['username'], password=conn_args['password'])
|
60
|
41
|
|