Browse Source

sort and format

main
crunk 11 months ago
parent
commit
7db20b290e
  1. 11
      library/app.py
  2. 14
      library/application/user/forgotpassword.py
  3. 15
      library/application/user/loginuser.py
  4. 21
      library/application/user/registeruser.py
  5. 22
      library/application/user/resetpassword.py
  6. 2
      library/deploydb.py
  7. 9
      library/forms/forgotpasswordform.py
  8. 10
      library/forms/loginform.py
  9. 10
      library/forms/registerform.py
  10. 9
      library/forms/resetpasswordform.py
  11. 13
      library/page.py
  12. 3
      library/search.py
  13. 4
      setup.py

11
library/app.py

@ -3,21 +3,17 @@ import os
import tomllib
import flask_apscheduler
from application.csvparser import CsvParser
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_wtf.csrf import CSRFProtect
from flask_login import (
LoginManager,
)
from whoosh.fields import *
from whoosh.index import create_in
from whoosh.qparser import QueryParser
from application.csvparser import CsvParser
db = SQLAlchemy()
migrate = Migrate()
bcrypt = Bcrypt()
@ -26,6 +22,7 @@ login_manager = LoginManager()
SCRIPT_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "data"))
def create_app():
settings = settings_from_file()

14
library/application/user/forgotpassword.py

@ -1,17 +1,17 @@
from uuid import uuid1
from datetime import datetime
from uuid import uuid1
from app import db
from flask import render_template
from flask_mail import Message
from forms.forgotpasswordform import ForgotPasswordForm
from sqlalchemy.exc import (
DataError,
DatabaseError,
DataError,
InterfaceError,
InvalidRequestError,
)
from flask import render_template
from flask_mail import Message
from usermodel import User
from forms.forgotpasswordform import ForgotPasswordForm
from app import db
def ForgotPassword(mail):

15
library/application/user/loginuser.py

@ -1,15 +1,8 @@
from flask import (
render_template,
redirect,
request,
flash,
url_for,
abort,
)
from usermodel import User
from forms.loginform import LoginForm
from flask_login import login_user
from flask import abort, flash, redirect, render_template, request, url_for
from flask_bcrypt import check_password_hash
from flask_login import login_user
from forms.loginform import LoginForm
from usermodel import User
def LoginUser():

21
library/application/user/registeruser.py

@ -1,22 +1,17 @@
from flask import (
render_template,
redirect,
flash,
url_for,
)
from app import db
from flask import flash, redirect, render_template, url_for
from flask_bcrypt import generate_password_hash
from flask_login import login_user
from forms.registerform import RegisterForm
from sqlalchemy.exc import (
IntegrityError,
DataError,
DatabaseError,
DataError,
IntegrityError,
InterfaceError,
InvalidRequestError,
)
from werkzeug.routing import BuildError
from usermodel import User
from forms.registerform import RegisterForm
from flask_login import login_user
from flask_bcrypt import generate_password_hash
from app import db
from werkzeug.routing import BuildError
def RegisterUser():

22
library/application/user/resetpassword.py

@ -1,23 +1,19 @@
from datetime import datetime
from flask import (
render_template,
redirect,
flash,
url_for,
)
from app import db
from flask import flash, redirect, render_template, url_for
from flask_bcrypt import generate_password_hash
from flask_login import login_user
from forms.resetpasswordform import ResetPasswordForm
from sqlalchemy.exc import (
IntegrityError,
DataError,
DatabaseError,
DataError,
IntegrityError,
InterfaceError,
InvalidRequestError,
)
from werkzeug.routing import BuildError
from usermodel import User
from forms.resetpasswordform import ResetPasswordForm
from flask_login import login_user
from flask_bcrypt import generate_password_hash
from app import db
from werkzeug.routing import BuildError
def ResetPassword(path):

2
library/deploydb.py

@ -1,5 +1,5 @@
from app import create_app, db
from flask_migrate import upgrade, migrate, init, stamp
from flask_migrate import init, migrate, stamp, upgrade
def deploy():

9
library/forms/forgotpasswordform.py

@ -1,12 +1,7 @@
"""Forgotten password form to help user."""
from wtforms import (
StringField,
SubmitField,
)
from wtforms import validators
from wtforms.validators import Length, Email
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, validators
from wtforms.validators import Email, Length
class ForgotPasswordForm(FlaskForm):

10
library/forms/loginform.py

@ -1,13 +1,7 @@
"""Login form to validate user."""
from wtforms import (
StringField,
SubmitField,
PasswordField,
)
from wtforms import validators
from wtforms.validators import Length, Email
from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField, SubmitField, validators
from wtforms.validators import Email, Length
class LoginForm(FlaskForm):

10
library/forms/registerform.py

@ -1,13 +1,7 @@
"""Register form to make a new user."""
from wtforms import (
StringField,
SubmitField,
PasswordField,
)
from wtforms import validators
from wtforms.validators import Length, Email, EqualTo, ValidationError
from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField, SubmitField, validators
from wtforms.validators import Email, EqualTo, Length, ValidationError
class RegisterForm(FlaskForm):

9
library/forms/resetpasswordform.py

@ -1,12 +1,7 @@
"""Reset Password Form form to reset a users PasswordField."""
from wtforms import (
SubmitField,
PasswordField,
)
from wtforms import validators
from wtforms.validators import Length, EqualTo
from flask_wtf import FlaskForm
from wtforms import PasswordField, SubmitField, validators
from wtforms.validators import EqualTo, Length
class ResetPasswordForm(FlaskForm):

13
library/page.py

@ -6,18 +6,17 @@ import json
import os
import bcrypt
from flask import redirect, render_template, request, Blueprint
from flask_wtf.csrf import CSRFProtect
from icalendar import Calendar
from PIL import Image
from requests import get
from werkzeug.utils import secure_filename
from app import create_app
from application.csvparser import CsvParser
from flask import Blueprint, redirect, render_template, request
from flask_wtf.csrf import CSRFProtect
from forms.borrowform import BorrowForm
from forms.uploadform import PublicationForm
from icalendar import Calendar
from PIL import Image
from requests import get
from search import search
from werkzeug.utils import secure_filename
APP = create_app()
csrf = CSRFProtect()

3
library/search.py

@ -1,11 +1,10 @@
import os
from application.csvparser import CsvParser
from whoosh.fields import *
from whoosh.index import open_dir
from whoosh.qparser import QueryParser
from application.csvparser import CsvParser
SCRIPT_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "data"))

4
setup.py

@ -1,3 +1,3 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
setup(name='library', version='1.1', packages=find_packages())
setup(name="library", version="1.1", packages=find_packages())

Loading…
Cancel
Save