diff options
Diffstat (limited to 'utils/test/result_collection_api/update/templates')
-rw-r--r-- | utils/test/result_collection_api/update/templates/changes_in_mongodb.py | 3 | ||||
-rw-r--r-- | utils/test/result_collection_api/update/templates/update_mongodb.py | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py b/utils/test/result_collection_api/update/templates/changes_in_mongodb.py index 9744dd9fe..1a4d5a16f 100644 --- a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py +++ b/utils/test/result_collection_api/update/templates/changes_in_mongodb.py @@ -45,6 +45,7 @@ docs_old2New = { # ({'case_name': 'ovno'}, {'case_name': 'ocl'}) # ] 'results': [ - ({'trust_indicator': 0}, {'trust_indicator': {'current': 0, 'histories': []}}) + ({'trust_indicator': 0}, + {'trust_indicator': {'current': 0, 'histories': []}}) ] } diff --git a/utils/test/result_collection_api/update/templates/update_mongodb.py b/utils/test/result_collection_api/update/templates/update_mongodb.py index b1e378dd7..ba4334aa3 100644 --- a/utils/test/result_collection_api/update/templates/update_mongodb.py +++ b/utils/test/result_collection_api/update/templates/update_mongodb.py @@ -10,7 +10,8 @@ import argparse from pymongo import MongoClient -from changes_in_mongodb import collections_old2New, fields_old2New, docs_old2New +from changes_in_mongodb import collections_old2New, \ + fields_old2New, docs_old2New from utils import main, parse_mongodb_url parser = argparse.ArgumentParser(description='Update MongoDBs') @@ -54,11 +55,13 @@ def change_docs(a_dict): def eval_db(method, *args, **kwargs): - return eval('db.%s(*args, **kwargs)' % method) + exec_db = db.__getattribute__(method) + return exec_db(*args, **kwargs) def eval_collection(collection, method, *args, **kwargs): - return eval('db.%s.%s(*args, **kwargs)' % (collection, method)) + exec_collection = db.__getattr__(collection) + return exec_collection.__getattribute__(method)(*args, **kwargs) def collection_update(a_dict, operator): |