ruff refactoring
This commit is contained in:
parent
ff8215a7de
commit
bbf2fcf047
@ -64,7 +64,6 @@ def get_app():
|
||||
|
||||
|
||||
def settings_from_file():
|
||||
settings = {}
|
||||
if os.path.isfile("settings_development.toml"):
|
||||
with open("settings_development.toml", "rb") as settings_file:
|
||||
return tomllib.load(settings_file)
|
||||
|
@ -1,4 +1,5 @@
|
||||
from flask import Blueprint, render_template
|
||||
from flask import Blueprint, render_template, redirect, url_for
|
||||
from flask_login import current_user
|
||||
from models.distribusi_model import Distribusis
|
||||
from models.distribusi_file_model import DistribusiFiles
|
||||
|
||||
@ -12,11 +13,12 @@ describer = Blueprint(
|
||||
|
||||
@describer.route("/<string:distribusiname>")
|
||||
def describe_distribusi_files(distribusiname):
|
||||
if not current_user.is_authenticated:
|
||||
return redirect(url_for("index"))
|
||||
distribusi = Distribusis.query.filter_by(
|
||||
distribusiname=distribusiname
|
||||
).first()
|
||||
distribusi_files = DistribusiFiles.query.filter_by(
|
||||
distribusi=distribusi.id
|
||||
).all()
|
||||
print(distribusi_files)
|
||||
return render_template("describe.html", distribusi_files=distribusi_files)
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Describe File Form to describe files in the distribusi archive"""
|
||||
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField
|
||||
|
||||
from wtforms import StringField, SubmitField, validators
|
||||
from wtforms.validators import Length
|
||||
|
||||
class DescribeFileForm(FlaskForm):
|
||||
"""DescribeFileForm selection form."""
|
||||
|
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<div class="distribusi_files">
|
||||
{% for file in distribusi_files %}
|
||||
<p>{{file}}</p>
|
||||
<p>{{file.path}}</p>
|
||||
{% endfor%}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -4,7 +4,6 @@ from flask_login import login_required
|
||||
from distribusikan.distribusiselector import DistribusiSelector
|
||||
|
||||
# Distribusi Information
|
||||
from distribusikan.distribusisinfo import DistribusisInfo
|
||||
from distribusikan.distribusiworkflow import DistribusiWorkflow
|
||||
from distribusikan.editor import Editor
|
||||
from distribusikan.themeselector import ThemeSelector
|
||||
|
@ -10,9 +10,8 @@ from sqlalchemy.exc import (
|
||||
InvalidRequestError,
|
||||
)
|
||||
|
||||
from app import db, get_app
|
||||
from app import db
|
||||
from distribusikan.distribusisinfo import DistribusisInfo
|
||||
from describer.describe_files import describe_distribusi_files
|
||||
from forms.distribusiform import DistribusiForm
|
||||
from forms.publicthemeform import PublicThemeForm
|
||||
from forms.selectorform import SelectorForm
|
||||
@ -68,7 +67,6 @@ def SelectNewDistribusi():
|
||||
|
||||
|
||||
def SelectDescribeDistribusi(distribusiname):
|
||||
app = get_app
|
||||
return redirect(
|
||||
url_for(
|
||||
"describer.describe_distribusi_files",
|
||||
|
@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
import magic
|
||||
from distribusi.mappings import CODE_TYPES, FILE_TYPES, SUB_TYPES
|
||||
from distribusi.mappings import FILE_TYPES
|
||||
from models.distribusi_model import Distribusis
|
||||
from models.distribusi_file_model import DistribusiFiles
|
||||
from app import create_app, get_app, db
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import PasswordField, StringField, SubmitField, validators
|
||||
from wtforms.validators import Email, EqualTo, Length, ValidationError
|
||||
from wtforms.validators import Email, EqualTo, Length
|
||||
|
||||
|
||||
class RegisterForm(FlaskForm):
|
||||
|
@ -1,7 +1,6 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileAllowed, FileField, FileRequired, FileSize
|
||||
from wtforms import (
|
||||
IntegerField,
|
||||
SelectField,
|
||||
StringField,
|
||||
SubmitField,
|
||||
@ -10,7 +9,6 @@ from wtforms import (
|
||||
from wtforms.validators import (
|
||||
DataRequired,
|
||||
Length,
|
||||
NumberRange,
|
||||
ValidationError,
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,6 @@ from datetime import timedelta
|
||||
from flask import (Blueprint, redirect, render_template, send_from_directory,
|
||||
session, url_for)
|
||||
from flask_login import current_user, login_required, logout_user
|
||||
from flask_mail import Mail
|
||||
from flask_wtf.csrf import CSRFError
|
||||
|
||||
from adminpage import AdminPage
|
||||
|
@ -5,8 +5,6 @@ from flask import (
|
||||
redirect,
|
||||
render_template,
|
||||
request,
|
||||
send_from_directory,
|
||||
session,
|
||||
url_for,
|
||||
)
|
||||
from flask_bcrypt import check_password_hash
|
||||
|
@ -1,6 +1,6 @@
|
||||
from datetime import datetime
|
||||
|
||||
from flask import flash, redirect, render_template, url_for
|
||||
from flask import Blueprint, flash, redirect, render_template, url_for
|
||||
from flask_bcrypt import generate_password_hash
|
||||
from flask_login import login_user
|
||||
from sqlalchemy.exc import (
|
||||
@ -15,7 +15,6 @@ from werkzeug.routing import BuildError
|
||||
from app import db
|
||||
from forms.resetpasswordform import ResetPasswordForm
|
||||
from models.user_model import User
|
||||
from statuspengguna import statuspengguna
|
||||
|
||||
reset_password = Blueprint(
|
||||
"reset_password",
|
||||
|
Loading…
Reference in New Issue
Block a user