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