diff --git a/app/admin/__init__.py b/app/admin/__init__.py index 22877f95..9bb011f8 100644 --- a/app/admin/__init__.py +++ b/app/admin/__init__.py @@ -1,5 +1,5 @@ from flask import Blueprint -admin = Blueprint('admin', __name__) +admin = Blueprint('admin', __name__) from . import views diff --git a/app/auth/__init__.py b/app/auth/__init__.py index e54b37dc..a45dc3f3 100644 --- a/app/auth/__init__.py +++ b/app/auth/__init__.py @@ -1,5 +1,5 @@ from flask import Blueprint -auth = Blueprint('auth', __name__) +auth = Blueprint('auth', __name__) from . import views diff --git a/app/corpora/__init__.py b/app/corpora/__init__.py index 8323ec6a..73084f46 100644 --- a/app/corpora/__init__.py +++ b/app/corpora/__init__.py @@ -1,5 +1,5 @@ from flask import Blueprint -corpora = Blueprint('corpora', __name__) +corpora = Blueprint('corpora', __name__) from . import events, views diff --git a/app/corpora/views.py b/app/corpora/views.py index 205cfe2b..81391b68 100644 --- a/app/corpora/views.py +++ b/app/corpora/views.py @@ -1,4 +1,4 @@ -from app import db +from app import db, logger from app.models import Corpus, CorpusFile from flask import (abort, current_app, flash, redirect, request, render_template, url_for, send_from_directory) @@ -11,7 +11,6 @@ from .forms import (AddCorpusFileForm, AddCorpusForm, EditCorpusFileForm, QueryDownloadForm, QueryForm) import os import threading -import logging @corpora.route('/add', methods=['GET', 'POST']) @@ -52,7 +51,6 @@ def corpus(corpus_id): @corpora.route('//analysis', methods=['GET', 'POST']) @login_required def corpus_analysis(corpus_id): - logger = logging.getLogger(__name__) corpus = Corpus.query.get_or_404(corpus_id) if corpus.status == 'prepared': corpus.status = 'start analysis' @@ -64,7 +62,6 @@ def corpus_analysis(corpus_id): dl_form = QueryDownloadForm() form = QueryForm(hits_per_page=hits_per_page, context=context, query=query) if form.validate_on_submit(): - logger = logging.getLogger(__name__) logger.warning('Data has been sent!') logger.warning('Data labels: {data}'.format(data=[data for data in form.data])) logger.warning('Query Second: {q}'.format(q=form.query.data)) diff --git a/app/jobs/__init__.py b/app/jobs/__init__.py index 3878875c..07e0e1bb 100644 --- a/app/jobs/__init__.py +++ b/app/jobs/__init__.py @@ -1,6 +1,5 @@ from flask import Blueprint + jobs = Blueprint('jobs', __name__) - - -from . import forms, views +from . import views diff --git a/app/main/__init__.py b/app/main/__init__.py index 1baeacf6..ed1e65e9 100644 --- a/app/main/__init__.py +++ b/app/main/__init__.py @@ -1,10 +1,9 @@ from flask import Blueprint + main = Blueprint('main', __name__) - - from . import errors, views -from ..models import Permission +from app.models import Permission @main.app_context_processor diff --git a/app/profile/__init__.py b/app/profile/__init__.py index 5b7be466..8283a75f 100644 --- a/app/profile/__init__.py +++ b/app/profile/__init__.py @@ -2,7 +2,4 @@ from flask import Blueprint profile = Blueprint('profile', __name__) - - from . import views -from ..models import Permission diff --git a/app/profile/forms.py b/app/profile/forms.py index ca6220be..840e30cf 100644 --- a/app/profile/forms.py +++ b/app/profile/forms.py @@ -1,8 +1,8 @@ +from app.models import User from flask_wtf import FlaskForm from wtforms import (PasswordField, StringField, SubmitField, ValidationError, BooleanField) from wtforms.validators import DataRequired, EqualTo, Email -from ..models import User class ChangePasswordForm(FlaskForm): diff --git a/app/profile/views.py b/app/profile/views.py index 9cc60cc2..395a6004 100644 --- a/app/profile/views.py +++ b/app/profile/views.py @@ -1,13 +1,10 @@ +from app import db, logger from app.utils import background_delete_user from flask import abort, current_app, flash, redirect, render_template, url_for from flask_login import current_user, login_required, logout_user from . import profile from .forms import ChangePasswordForm, EditProfileForm, EditUserSettingsForm -from .. import db import threading -import logging - -logger = logging.getLogger(__name__) @profile.route('/', methods=['GET', 'POST']) diff --git a/app/services/__init__.py b/app/services/__init__.py index bb1dcf3d..ea9a403f 100644 --- a/app/services/__init__.py +++ b/app/services/__init__.py @@ -1,5 +1,5 @@ from flask import Blueprint -services = Blueprint('services', __name__) +services = Blueprint('services', __name__) from . import views diff --git a/app/utils.py b/app/utils.py index e6676262..b7c1feed 100644 --- a/app/utils.py +++ b/app/utils.py @@ -1,6 +1,5 @@ -from . import db +from . import db, logger from .models import Job, User, Corpus, CorpusFile -import logging ''' @@ -11,7 +10,6 @@ import logging def background_delete_user(app, current_user_id): with app.app_context(): - logger = logging.getLogger(__name__) logger.warning('Called by delete_thread.') logger.warning('User id is: {}.'.format(current_user_id)) jobs = Job.query.filter_by(user_id=current_user_id).all() @@ -38,7 +36,6 @@ def background_delete_user(app, current_user_id): def background_delete_job(app, job_id): - logger = logging.getLogger(__name__) with app.app_context(): logger.warning('Called by delete_thread.') logger.warning('Job id is: {}.'.format(job_id))