From 9de09519d64554b75b33180d634ffd3aabac5aa4 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Tue, 28 Mar 2023 14:19:37 +0200
Subject: [PATCH] more normalization
---
app/auth/routes.py | 21 +++++++----
.../spacy_nlp_pipeline_models/routes.py | 8 ++---
.../tesseract_ocr_pipeline_models/routes.py | 8 ++---
app/corpora/files/routes.py | 12 +++----
app/corpora/routes.py | 12 +++----
app/jobs/routes.py | 4 +--
app/main/routes.py | 35 ++++++++++++++-----
app/services/routes.py | 14 ++++----
app/users/routes.py | 4 +--
9 files changed, 72 insertions(+), 46 deletions(-)
diff --git a/app/auth/routes.py b/app/auth/routes.py
index d6f11953..1f30d58a 100644
--- a/app/auth/routes.py
+++ b/app/auth/routes.py
@@ -60,8 +60,8 @@ def register():
return redirect(url_for('.login'))
return render_template(
'auth/register.html.j2',
- form=form,
- title='Register'
+ title='Register',
+ form=form
)
@@ -81,7 +81,11 @@ def login():
flash('You have been logged in')
return redirect(next)
flash('Invalid email/username or password', category='error')
- return render_template('auth/login.html.j2', form=form, title='Log in')
+ return render_template(
+ 'auth/login.html.j2',
+ title='Log in',
+ form=form
+ )
@bp.route('/logout')
@@ -98,7 +102,10 @@ def logout():
def unconfirmed():
if current_user.confirmed:
return redirect(url_for('main.dashboard'))
- return render_template('auth/unconfirmed.html.j2', title='Unconfirmed')
+ return render_template(
+ 'auth/unconfirmed.html.j2',
+ title='Unconfirmed'
+ )
@bp.route('/confirm-request')
@@ -157,8 +164,8 @@ def reset_password_request():
return redirect(url_for('.login'))
return render_template(
'auth/reset_password_request.html.j2',
- form=form,
- title='Password Reset'
+ title='Password Reset',
+ form=form
)
@@ -176,7 +183,7 @@ def reset_password(token):
return redirect(url_for('main.index'))
return render_template(
'auth/reset_password.html.j2',
- form=form,
title='Password Reset',
+ form=form,
token=token
)
diff --git a/app/contributions/spacy_nlp_pipeline_models/routes.py b/app/contributions/spacy_nlp_pipeline_models/routes.py
index 7ed0797e..91dee8c7 100644
--- a/app/contributions/spacy_nlp_pipeline_models/routes.py
+++ b/app/contributions/spacy_nlp_pipeline_models/routes.py
@@ -54,8 +54,8 @@ def create_spacy_nlp_pipeline_model():
return {}, 201, {'Location': url_for('.spacy_nlp_pipeline_models')}
return render_template(
'contributions/spacy_nlp_pipeline_models/create_spacy_nlp_pipeline_model.html.j2',
- form=form,
- title='Create SpaCy NLP Pipeline Model'
+ title='Create SpaCy NLP Pipeline Model',
+ form=form
)
@@ -77,7 +77,7 @@ def spacy_nlp_pipeline_model(spacy_nlp_pipeline_model_id):
return redirect(url_for('.spacy_nlp_pipeline_models'))
return render_template(
'contributions/spacy_nlp_pipeline_models/spacy_nlp_pipeline_model.html.j2',
+ title=f'{snpm.title} {snpm.version}',
form=form,
- spacy_nlp_pipeline_model=snpm,
- title=f'{snpm.title} {snpm.version}'
+ spacy_nlp_pipeline_model=snpm
)
diff --git a/app/contributions/tesseract_ocr_pipeline_models/routes.py b/app/contributions/tesseract_ocr_pipeline_models/routes.py
index 71f281ad..31552a59 100644
--- a/app/contributions/tesseract_ocr_pipeline_models/routes.py
+++ b/app/contributions/tesseract_ocr_pipeline_models/routes.py
@@ -53,8 +53,8 @@ def create_tesseract_ocr_pipeline_model():
return {}, 201, {'Location': url_for('.tesseract_ocr_pipeline_models')}
return render_template(
'contributions/tesseract_ocr_pipeline_models/create_tesseract_ocr_pipeline_model.html.j2',
- form=form,
- title='Create Tesseract OCR Pipeline Model'
+ title='Create Tesseract OCR Pipeline Model',
+ form=form
)
@@ -76,7 +76,7 @@ def tesseract_ocr_pipeline_model(tesseract_ocr_pipeline_model_id):
return redirect(url_for('.tesseract_ocr_pipeline_models'))
return render_template(
'contributions/tesseract_ocr_pipeline_models/tesseract_ocr_pipeline_model.html.j2',
+ title=f'{topm.title} {topm.version}',
form=form,
- tesseract_ocr_pipeline_model=topm,
- title=f'{topm.title} {topm.version}'
+ tesseract_ocr_pipeline_model=topm
)
diff --git a/app/corpora/files/routes.py b/app/corpora/files/routes.py
index 0215e45e..7dca50a2 100644
--- a/app/corpora/files/routes.py
+++ b/app/corpora/files/routes.py
@@ -24,7 +24,7 @@ from .utils import (
@register_breadcrumb(bp, '.entity.files', 'Files', endpoint_arguments_constructor=corpus_eac)
@login_required
def corpus_files(corpus_id):
- return redirect(url_for('.corpus', corpus_id=corpus_id, _anchor='files'))
+ return redirect(url_for('.corpus', _anchor='files', corpus_id=corpus_id))
@bp.route('//files/create', methods=['GET', 'POST'])
@@ -64,9 +64,9 @@ def create_corpus_file(corpus_id):
return '', 201, {'Location': corpus.url}
return render_template(
'corpora/files/create_corpus_file.html.j2',
- corpus=corpus,
+ title='Add corpus file',
form=form,
- title='Add corpus file'
+ corpus=corpus
)
@@ -86,10 +86,10 @@ def corpus_file(corpus_id, corpus_file_id):
return redirect(corpus_file.corpus.url)
return render_template(
'corpora/files/corpus_file.html.j2',
- corpus=corpus_file.corpus,
- corpus_file=corpus_file,
+ title='Edit corpus file',
form=form,
- title='Edit corpus file'
+ corpus=corpus_file.corpus,
+ corpus_file=corpus_file
)
diff --git a/app/corpora/routes.py b/app/corpora/routes.py
index 1a05722e..ae5069fa 100644
--- a/app/corpora/routes.py
+++ b/app/corpora/routes.py
@@ -43,8 +43,8 @@ def create_corpus():
return redirect(corpus.url)
return render_template(
'corpora/create_corpus.html.j2',
- form=form,
- title='Create corpus'
+ title='Create corpus',
+ form=form
)
@@ -59,18 +59,18 @@ def corpus(corpus_id):
if corpus.user == current_user or current_user.is_administrator():
return render_template(
'corpora/corpus.html.j2',
+ title=corpus.title,
corpus=corpus,
corpus_follower_roles=corpus_follower_roles,
- users = users,
- title=corpus.title
+ users = users
)
if current_user.is_following_corpus(corpus) or corpus.is_public:
cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=current_user.id).first_or_404()
return render_template(
'corpora/public_corpus.html.j2',
+ title=corpus.title,
corpus=corpus,
- cfa=cfa,
- title=corpus.title
+ cfa=cfa
)
abort(403)
diff --git a/app/jobs/routes.py b/app/jobs/routes.py
index 2533e010..5f0d6273 100644
--- a/app/jobs/routes.py
+++ b/app/jobs/routes.py
@@ -29,8 +29,8 @@ def job(job_id):
abort(403)
return render_template(
'jobs/job.html.j2',
- job=job,
- title='Job'
+ title='Job',
+ job=job
)
diff --git a/app/main/routes.py b/app/main/routes.py
index edca61d5..b14b3ae9 100644
--- a/app/main/routes.py
+++ b/app/main/routes.py
@@ -18,20 +18,30 @@ def index():
return redirect(url_for('.dashboard'))
flash('Invalid email/username or password', category='error')
redirect(url_for('.index'))
- return render_template('main/index.html.j2', form=form, title='nopaque')
+ return render_template(
+ 'main/index.html.j2',
+ title='nopaque',
+ form=form
+ )
@bp.route('/faq')
@register_breadcrumb(bp, '.faq', 'Frequently Asked Questions')
def faq():
- return render_template('main/faq.html.j2', title='Frequently Asked Questions')
+ return render_template(
+ 'main/faq.html.j2',
+ title='Frequently Asked Questions'
+ )
@bp.route('/dashboard')
@register_breadcrumb(bp, '.dashboard', 'dashboardDashboard')
@login_required
def dashboard():
- return render_template('main/dashboard.html.j2', title='Dashboard')
+ return render_template(
+ 'main/dashboard.html.j2',
+ title='Dashboard'
+ )
# @bp.route('/user_manual')
@@ -43,19 +53,28 @@ def dashboard():
@bp.route('/news')
@register_breadcrumb(bp, '.news', 'emailNews')
def news():
- return render_template('main/news.html.j2', title='News')
+ return render_template(
+ 'main/news.html.j2',
+ title='News'
+ )
@bp.route('/privacy_policy')
@register_breadcrumb(bp, '.privacy_policy', 'Private statement (GDPR)')
def privacy_policy():
- return render_template('main/privacy_policy.html.j2', title='Privacy statement (GDPR)')
+ return render_template(
+ 'main/privacy_policy.html.j2',
+ title='Privacy statement (GDPR)'
+ )
@bp.route('/terms_of_use')
@register_breadcrumb(bp, '.terms_of_use', 'Terms of Use')
def terms_of_use():
- return render_template('main/terms_of_use.html.j2', title='Terms of Use')
+ return render_template(
+ 'main/terms_of_use.html.j2',
+ title='Terms of Use'
+ )
@bp.route('/social-area')
@@ -73,7 +92,7 @@ def social_area():
users = User.query.filter(User.is_public == True, User.id != current_user.id).all()
return render_template(
'main/social_area.html.j2',
- users=users,
+ title='Social Area',
corpora=corpora,
- title='Social Area'
+ users=users
)
diff --git a/app/services/routes.py b/app/services/routes.py
index 5a6ec7fd..324aab63 100644
--- a/app/services/routes.py
+++ b/app/services/routes.py
@@ -63,8 +63,8 @@ def file_setup_pipeline():
return {}, 201, {'Location': job.url}
return render_template(
'services/file_setup_pipeline.html.j2',
- form=form,
- title=service_manifest['name']
+ title=service_manifest['name'],
+ form=form
)
@@ -112,9 +112,9 @@ def tesseract_ocr_pipeline():
]
return render_template(
'services/tesseract_ocr_pipeline.html.j2',
+ title=service_manifest['name'],
form=form,
- tesseract_ocr_pipeline_models=tesseract_ocr_pipeline_models,
- title=service_manifest['name']
+ tesseract_ocr_pipeline_models=tesseract_ocr_pipeline_models
)
@@ -172,8 +172,8 @@ def transkribus_htr_pipeline():
return {}, 201, {'Location': job.url}
return render_template(
'services/transkribus_htr_pipeline.html.j2',
- form=form,
title=service_manifest['name'],
+ form=form,
transkribus_htr_pipeline_models=transkribus_htr_pipeline_models
)
@@ -218,9 +218,9 @@ def spacy_nlp_pipeline():
return {}, 201, {'Location': job.url}
return render_template(
'services/spacy_nlp_pipeline.html.j2',
+ title=service_manifest['name'],
form=form,
- spacy_nlp_pipeline_models=spacy_nlp_pipeline_models,
- title=service_manifest['name']
+ spacy_nlp_pipeline_models=spacy_nlp_pipeline_models
)
diff --git a/app/users/routes.py b/app/users/routes.py
index 2c2334f3..7b86a8e1 100644
--- a/app/users/routes.py
+++ b/app/users/routes.py
@@ -29,8 +29,8 @@ def user(user_id):
abort(403)
return render_template(
'users/user.html.j2',
- user=user,
- title=user.username
+ title=user.username,
+ user=user
)