diff --git a/app/db/clear_users.py b/app/db/clear_users.py index 63f7a1d2..3d38fa8f 100644 --- a/app/db/clear_users.py +++ b/app/db/clear_users.py @@ -1,6 +1,6 @@ import logging -from .db_methods import client +from .db_main import client logger = logging.getLogger('root_logger') diff --git a/app/db/db_methods.py b/app/db/db_main.py similarity index 100% rename from app/db/db_methods.py rename to app/db/db_main.py diff --git a/app/db/db_types.py b/app/db/db_types.py deleted file mode 100644 index 3379462a..00000000 --- a/app/db/db_types.py +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -# You shouldn't create or change this explicitly - - - diff --git a/app/db/methods/celery_check.py b/app/db/methods/celery_check.py index 27ca63f8..67314a01 100644 --- a/app/db/methods/celery_check.py +++ b/app/db/methods/celery_check.py @@ -1,13 +1,9 @@ from datetime import datetime -from app.db.db_methods import get_celery_check_collection -from app.db.methods.client import get_client, get_db, get_fs +from app.db.db_main import get_celery_check_collection +from app.db.methods.client import get_db -from app.db.types.Logs import Logs - -# client = get_client() db = get_db() -# fs = get_fs() celery_check_collection = get_celery_check_collection() # collection for mapping celery_task to check diff --git a/app/db/methods/check.py b/app/db/methods/check.py index 2dbc1cca..ed5abeb9 100644 --- a/app/db/methods/check.py +++ b/app/db/methods/check.py @@ -1,14 +1,13 @@ -from gridfs import GridFSBucket, NoFile +from gridfs import NoFile from datetime import datetime import pymongo -from app.db.db_methods import get_checks_collection, get_users_collection, get_files_info_collection -from app.db.methods.client import get_client, get_db, get_fs +from app.db.db_main import get_checks_collection, get_users_collection, get_files_info_collection +from app.db.methods.client import get_db, get_fs from app.db.types.Check import Check -# client = get_client() db = get_db() fs = get_fs() @@ -18,9 +17,6 @@ files_info_collection = get_files_info_collection() - - - def add_check(file_id, check): checks_id = checks_collection.insert_one(check.pack()).inserted_id files_info_collection.update_one({'_id': file_id}, {"$push": {'checks': checks_id}}) @@ -134,7 +130,6 @@ def get_checks_cursor(filter={}, limit=10, offset=0, sort=None, order=None): # get logs cursor with specified parameters - def get_user_checks(login): return checks_collection.find({'user': login}) diff --git a/app/db/methods/criteria_pack.py b/app/db/methods/criteria_pack.py index 5c603d67..0fc42e81 100644 --- a/app/db/methods/criteria_pack.py +++ b/app/db/methods/criteria_pack.py @@ -1,11 +1,9 @@ from datetime import datetime -from app.db.db_methods import get_criteria_pack_collection -from app.db.methods.client import get_client, get_db, get_fs +from app.db.db_main import get_criteria_pack_collection +from app.db.methods.client import get_db, get_fs -# from app.db.types. import Logs -# client = get_client() db = get_db() fs = get_fs() diff --git a/app/db/methods/edit_user.py b/app/db/methods/edit_user.py index d123ed31..8a432cbe 100644 --- a/app/db/methods/edit_user.py +++ b/app/db/methods/edit_user.py @@ -1,4 +1,4 @@ -from app.db.db_methods import users_collection +from app.db.db_main import users_collection def edit_user(user): diff --git a/app/db/methods/file.py b/app/db/methods/file.py index 8e0941f8..63bb2109 100644 --- a/app/db/methods/file.py +++ b/app/db/methods/file.py @@ -1,4 +1,4 @@ -from app.db.db_methods import get_files_info_collection, get_users_collection +from app.db.db_main import get_files_info_collection, get_users_collection from app.db.methods.client import get_client, get_db, get_fs from os.path import basename from bson import ObjectId diff --git a/app/db/methods/log.py b/app/db/methods/log.py index 0b0e4b1c..ccf476b2 100644 --- a/app/db/methods/log.py +++ b/app/db/methods/log.py @@ -1,13 +1,11 @@ import pymongo -from app.db.db_methods import get_logs_collection -from app.db.methods.client import get_client, get_db, get_fs +from app.db.db_main import get_logs_collection +from app.db.methods.client import get_db from app.db.types.Logs import Logs -# client = get_client() db = get_db() -# fs = get_fs() logs_collection = get_logs_collection() diff --git a/app/db/methods/user.py b/app/db/methods/user.py index 4b206468..3af14b4b 100644 --- a/app/db/methods/user.py +++ b/app/db/methods/user.py @@ -1,15 +1,12 @@ import pymongo -from app.db.db_methods import get_users_collection +from app.db.db_main import get_users_collection from app.db.methods.client import get_db from app.db.types.User import User from app.db.methods.file import delete_presentation - -# client = get_client() db = get_db() -# fs = get_fs() users_collection = get_users_collection() diff --git a/app/db/types/ConsumerDBManager.py b/app/db/types/ConsumerDBManager.py index dbbee284..f1f3b01d 100644 --- a/app/db/types/ConsumerDBManager.py +++ b/app/db/types/ConsumerDBManager.py @@ -1,9 +1,8 @@ -from app.db.methods.client import get_client, get_db, get_fs +from app.db.methods.client import get_db, get_fs from app.db.types.Consumers import Consumers -# client = get_client() db = get_db() fs = get_fs() diff --git a/app/routes/check_list.py b/app/routes/check_list.py index 6e6aeb7e..3604eb78 100644 --- a/app/routes/check_list.py +++ b/app/routes/check_list.py @@ -1,7 +1,7 @@ from flask import Blueprint, render_template, jsonify, request from app.utils import format_check_for_table, checklist_filter -from app.db import db_methods +from app.db import db_main from app.db.methods import check as check_methods from flask_login import login_required, current_user diff --git a/app/routes/checks.py b/app/routes/checks.py index 8d1c7c34..c9b42266 100644 --- a/app/routes/checks.py +++ b/app/routes/checks.py @@ -4,7 +4,7 @@ from flask import Blueprint, render_template, Response from flask_login import login_required -from app.db import db_methods +from app.db import db_main from app.db.methods import file as file_methods from app.root_logger import get_root_logger diff --git a/app/routes/get_last_check_results.py b/app/routes/get_last_check_results.py index 42d6a886..3e0ce1cd 100644 --- a/app/routes/get_last_check_results.py +++ b/app/routes/get_last_check_results.py @@ -4,7 +4,7 @@ from flask import Blueprint, render_template, redirect, url_for from flask_login import login_required -from app.db import db_methods +from app.db import db_main from app.root_logger import get_root_logger diff --git a/app/routes/get_pdf.py b/app/routes/get_pdf.py index ef9d5180..b063d89c 100644 --- a/app/routes/get_pdf.py +++ b/app/routes/get_pdf.py @@ -4,7 +4,7 @@ from flask import Blueprint, Response, render_template from flask_login import login_required -from app.db import db_methods +from app.db import db_main from app.db.methods import file as file_methods from app.root_logger import get_root_logger diff --git a/app/routes/get_zip.py b/app/routes/get_zip.py index 443e8bf1..bfc186d0 100644 --- a/app/routes/get_zip.py +++ b/app/routes/get_zip.py @@ -9,7 +9,7 @@ from flask import Blueprint, abort, request, Response from flask_login import login_required, current_user -from app.db import db_methods +from app.db import db_main from app.db.methods import file as file_methods from app.db.methods import check as check_methods diff --git a/app/routes/logs.py b/app/routes/logs.py index 9e4688b4..674712cb 100644 --- a/app/routes/logs.py +++ b/app/routes/logs.py @@ -4,14 +4,10 @@ from app.root_logger import get_root_logger from datetime import datetime, timedelta from app.db.methods.log import get_logs_cursor -# from app.server_consts import logger logs = Blueprint('logs', __name__, template_folder='templates', static_folder='static') logger = get_root_logger('web') -# def get_logger(): -# return logger - @logs.route("/") @login_required def logs_main(): diff --git a/app/tasks.py b/app/tasks.py index c4554b6b..b94438bf 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -6,7 +6,7 @@ from celery.signals import worker_ready from passback_grades import run_passback -from db import db_methods +from db import db_main from db.types.Check import Check from main.checker import check from main.parser import parse