Change import logic.

This commit is contained in:
Patrick Jentsch 2019-11-12 13:36:22 +01:00
parent 2bebd0256c
commit 0d441a9364
11 changed files with 12 additions and 26 deletions

View File

@ -1,5 +1,5 @@
from flask import Blueprint from flask import Blueprint
admin = Blueprint('admin', __name__)
admin = Blueprint('admin', __name__)
from . import views from . import views

View File

@ -1,5 +1,5 @@
from flask import Blueprint from flask import Blueprint
auth = Blueprint('auth', __name__)
auth = Blueprint('auth', __name__)
from . import views from . import views

View File

@ -1,5 +1,5 @@
from flask import Blueprint from flask import Blueprint
corpora = Blueprint('corpora', __name__)
corpora = Blueprint('corpora', __name__)
from . import events, views from . import events, views

View File

@ -1,4 +1,4 @@
from app import db from app import db, logger
from app.models import Corpus, CorpusFile from app.models import Corpus, CorpusFile
from flask import (abort, current_app, flash, redirect, request, from flask import (abort, current_app, flash, redirect, request,
render_template, url_for, send_from_directory) render_template, url_for, send_from_directory)
@ -11,7 +11,6 @@ from .forms import (AddCorpusFileForm, AddCorpusForm, EditCorpusFileForm,
QueryDownloadForm, QueryForm) QueryDownloadForm, QueryForm)
import os import os
import threading import threading
import logging
@corpora.route('/add', methods=['GET', 'POST']) @corpora.route('/add', methods=['GET', 'POST'])
@ -52,7 +51,6 @@ def corpus(corpus_id):
@corpora.route('/<int:corpus_id>/analysis', methods=['GET', 'POST']) @corpora.route('/<int:corpus_id>/analysis', methods=['GET', 'POST'])
@login_required @login_required
def corpus_analysis(corpus_id): def corpus_analysis(corpus_id):
logger = logging.getLogger(__name__)
corpus = Corpus.query.get_or_404(corpus_id) corpus = Corpus.query.get_or_404(corpus_id)
if corpus.status == 'prepared': if corpus.status == 'prepared':
corpus.status = 'start analysis' corpus.status = 'start analysis'
@ -64,7 +62,6 @@ def corpus_analysis(corpus_id):
dl_form = QueryDownloadForm() dl_form = QueryDownloadForm()
form = QueryForm(hits_per_page=hits_per_page, context=context, query=query) form = QueryForm(hits_per_page=hits_per_page, context=context, query=query)
if form.validate_on_submit(): if form.validate_on_submit():
logger = logging.getLogger(__name__)
logger.warning('Data has been sent!') logger.warning('Data has been sent!')
logger.warning('Data labels: {data}'.format(data=[data for data in form.data])) logger.warning('Data labels: {data}'.format(data=[data for data in form.data]))
logger.warning('Query Second: {q}'.format(q=form.query.data)) logger.warning('Query Second: {q}'.format(q=form.query.data))

View File

@ -1,6 +1,5 @@
from flask import Blueprint from flask import Blueprint
jobs = Blueprint('jobs', __name__) jobs = Blueprint('jobs', __name__)
from . import views
from . import forms, views

View File

@ -1,10 +1,9 @@
from flask import Blueprint from flask import Blueprint
main = Blueprint('main', __name__) main = Blueprint('main', __name__)
from . import errors, views from . import errors, views
from ..models import Permission from app.models import Permission
@main.app_context_processor @main.app_context_processor

View File

@ -2,7 +2,4 @@ from flask import Blueprint
profile = Blueprint('profile', __name__) profile = Blueprint('profile', __name__)
from . import views from . import views
from ..models import Permission

View File

@ -1,8 +1,8 @@
from app.models import User
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from wtforms import (PasswordField, StringField, SubmitField, from wtforms import (PasswordField, StringField, SubmitField,
ValidationError, BooleanField) ValidationError, BooleanField)
from wtforms.validators import DataRequired, EqualTo, Email from wtforms.validators import DataRequired, EqualTo, Email
from ..models import User
class ChangePasswordForm(FlaskForm): class ChangePasswordForm(FlaskForm):

View File

@ -1,13 +1,10 @@
from app import db, logger
from app.utils import background_delete_user from app.utils import background_delete_user
from flask import abort, current_app, flash, redirect, render_template, url_for from flask import abort, current_app, flash, redirect, render_template, url_for
from flask_login import current_user, login_required, logout_user from flask_login import current_user, login_required, logout_user
from . import profile from . import profile
from .forms import ChangePasswordForm, EditProfileForm, EditUserSettingsForm from .forms import ChangePasswordForm, EditProfileForm, EditUserSettingsForm
from .. import db
import threading import threading
import logging
logger = logging.getLogger(__name__)
@profile.route('/', methods=['GET', 'POST']) @profile.route('/', methods=['GET', 'POST'])

View File

@ -1,5 +1,5 @@
from flask import Blueprint from flask import Blueprint
services = Blueprint('services', __name__)
services = Blueprint('services', __name__)
from . import views from . import views

View File

@ -1,6 +1,5 @@
from . import db from . import db, logger
from .models import Job, User, Corpus, CorpusFile from .models import Job, User, Corpus, CorpusFile
import logging
''' '''
@ -11,7 +10,6 @@ import logging
def background_delete_user(app, current_user_id): def background_delete_user(app, current_user_id):
with app.app_context(): with app.app_context():
logger = logging.getLogger(__name__)
logger.warning('Called by delete_thread.') logger.warning('Called by delete_thread.')
logger.warning('User id is: {}.'.format(current_user_id)) logger.warning('User id is: {}.'.format(current_user_id))
jobs = Job.query.filter_by(user_id=current_user_id).all() 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): def background_delete_job(app, job_id):
logger = logging.getLogger(__name__)
with app.app_context(): with app.app_context():
logger.warning('Called by delete_thread.') logger.warning('Called by delete_thread.')
logger.warning('Job id is: {}.'.format(job_id)) logger.warning('Job id is: {}.'.format(job_id))