Browse Source

sort, format and move models to folder

main
crunk 7 months ago
parent
commit
9e48758767
  1. 17
      verse/adminpage.py
  2. 14
      verse/admintool.py
  3. 9
      verse/app.py
  4. 8
      verse/deploydb.py
  5. 26
      verse/distribusiselector.py
  6. 4
      verse/distribusisinfo.py
  7. 46
      verse/distribusiworkflow.py
  8. 32
      verse/editor.py
  9. 8
      verse/forms/admindistribusiform.py
  10. 8
      verse/forms/adminuserform.py
  11. 13
      verse/forms/editorform.py
  12. 8
      verse/forms/forgotpasswordform.py
  13. 9
      verse/forms/loginform.py
  14. 6
      verse/forms/publicthemeform.py
  15. 13
      verse/forms/registerform.py
  16. 8
      verse/forms/resetpasswordform.py
  17. 2
      verse/forms/selectorform.py
  18. 6
      verse/forms/themeform.py
  19. 59
      verse/forms/uploadform.py
  20. 23
      verse/migrations/env.py
  21. 23
      verse/models/distribusimodel.py
  22. 23
      verse/models/usermodel.py
  23. 48
      verse/start.py
  24. 15
      verse/statuspengguna/forgotpassword.py
  25. 17
      verse/statuspengguna/helper.py
  26. 16
      verse/statuspengguna/loginuser.py
  27. 25
      verse/statuspengguna/registeruser.py
  28. 26
      verse/statuspengguna/resetpassword.py
  29. 12
      verse/themeselector.py
  30. 19
      verse/upload.py
  31. 8
      verse/uploadpage.py

17
verse/adminpage.py

@ -1,21 +1,16 @@
import os
import shutil
from flask import render_template
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from sqlalchemy.exc import (
DataError,
DatabaseError,
InterfaceError,
InvalidRequestError,
)
from app import db
from usermodel import User
from distribusimodel import Distribusis
from distribusisinfo import DistribusisInfo
from forms.adminuserform import AdminUserForm
from forms.admindistribusiform import AdminDistribusiForm
from forms.adminuserform import AdminUserForm
from models.distribusimodel import Distribusis
from models.usermodel import User
def AdminPage():

14
verse/admintool.py

@ -1,13 +1,11 @@
import sys
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import create_app, db
from sqlalchemy.exc import (
InvalidRequestError,
InterfaceError,
DataError,
DatabaseError,
)
from usermodel import User # noqa: F401
from distribusimodel import Distribusis # noqa: F401
from models.distribusimodel import Distribusis # noqa: F401
from models.usermodel import User # noqa: F401
def admintool():

9
verse/app.py

@ -1,12 +1,11 @@
import os
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,
)
db = SQLAlchemy()
migrate = Migrate()
@ -26,7 +25,7 @@ def create_app():
APP.config["MAIL_PORT"] = 587
APP.config["MAIL_USE_SSL"] = False
APP.config["MAIL_USE_TLS"] = True
APP.config['MAIL_USERNAME'] = "noreply@vvvvvvaria.org"
APP.config["MAIL_USERNAME"] = "noreply@vvvvvvaria.org"
login_manager.session_protection = "strong"
login_manager.login_view = "index"

8
verse/deploydb.py

@ -1,11 +1,11 @@
def deploy():
"""Run deployment of database."""
from app import create_app, db
from flask_migrate import upgrade, migrate, init, stamp
from flask_migrate import init, migrate, stamp, upgrade
from app import create_app, db
from models.distribusimodel import Distribusis # noqa: F401
# This model is required for flask_migrate to make the table
from usermodel import User # noqa: F401
from distribusimodel import Distribusis # noqa: F401
from models.usermodel import User # noqa: F401
app = create_app()
app.app_context().push()

26
verse/distribusiselector.py

@ -1,29 +1,23 @@
import os
import shutil
from flask import flash, render_template
from flask_login import current_user
from sqlalchemy.exc import (
DataError,
DatabaseError,
InterfaceError,
InvalidRequestError,
)
from usermodel import User
from distribusimodel import Distribusis
from distribusisinfo import DistribusisInfo
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from forms.selectorform import SelectorForm
from forms.uploadform import UploadForm
from app import db
from distribusisinfo import DistribusisInfo
from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
# UserPengguna
from statuspengguna.helper import UserHelper
from app import db
def DistribusiSelector():
uploadform = UploadForm()

4
verse/distribusisinfo.py

@ -1,7 +1,7 @@
from flask_login import current_user
from usermodel import User
from distribusimodel import Distribusis
from models.distribusimodel import Distribusis
from models.usermodel import User
class DistribusisInfo:

46
verse/distribusiworkflow.py

@ -1,40 +1,28 @@
import os
import shutil
import zipfile
from flask_login import current_user
from flask import (
render_template,
redirect,
url_for,
flash,
)
from sqlalchemy.exc import (
InvalidRequestError,
DataError,
InterfaceError,
DatabaseError,
)
from app import db
from usermodel import User
from distribusimodel import Distribusis
# Tada!
from distribusi.cli import build_argparser
from distribusi.distribusi import distribusify
from flask import flash, redirect, render_template, url_for
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
# UserPengguna
from statuspengguna.helper import UserHelper
from app import db
from distribusiselector import SelectorVisible
# Forms!
from forms.uploadform import UploadForm
from distribusisinfo import DistribusisInfo
from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from distribusisinfo import DistribusisInfo
# Tada!
from distribusi.cli import build_argparser
from distribusi.distribusi import distribusify
from forms.themeform import ThemeForm
# Forms!
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
# UserPengguna
from statuspengguna.helper import UserHelper
def DistribusiWorkflow():
@ -78,7 +66,7 @@ def CleanUpDistribusiFiles(userfolder):
def RemoveMacFolders(path):
for filename in os.listdir(path):
fullpath = os.path.join(path, filename)
if filename.startswith('.'):
if filename.startswith("."):
if os.path.isdir(fullpath):
shutil.rmtree(fullpath)
else:

32
verse/editor.py

@ -1,28 +1,23 @@
import os
import shutil
import bleach
from bleach_allowlist import all_styles
import shutil
from flask import render_template
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from werkzeug.utils import secure_filename
from sqlalchemy.exc import (
DataError,
DatabaseError,
InterfaceError,
InvalidRequestError,
)
from app import db
from distribusimodel import Distribusis
from statuspengguna.helper import UserHelper
from app import db
from distribusisinfo import DistribusisInfo
from forms.uploadform import UploadForm
from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm
from forms.publicthemeform import PublicThemeForm
from forms.editorform import EditorForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from statuspengguna.helper import UserHelper
def Editor():
@ -68,7 +63,7 @@ def SaveUploadCssFile(editorform, newcssfolder):
cssfile.save(os.path.join(newcssfolder, cssfilename))
openfile = open(os.path.join(newcssfolder, cssfilename), "r")
cleancss = bleach.clean(openfile.read(), all_styles)
cleancss = cleancss.replace('>', '>')
cleancss = cleancss.replace(">", ">")
openfile.close()
cleanfile = open(os.path.join(newcssfolder, cssfilename), "w")
cleanfile.write(cleancss)
@ -81,7 +76,7 @@ def WriteCssToFile(editorform, newcssfolder):
cssfilename = f"{secure_filename(editorform.cssname.data)}.css"
cleancss = bleach.clean(editorform.css.data, all_styles)
cleancss = cleancss.replace('>', '>')
cleancss = cleancss.replace(">", ">")
with open(os.path.join(newcssfolder, cssfilename), "w") as cssfile:
cssfile.write(cleancss)
cssfile.close
@ -91,8 +86,7 @@ def CopyPublicToUserFolder(editorform, publicfolder, newcssfolder):
if not os.path.exists(newcssfolder):
os.mkdir(newcssfolder)
copycssfile = os.path.join(
publicfolder,
f"{secure_filename(editorform.cssname.data)}.css"
publicfolder, f"{secure_filename(editorform.cssname.data)}.css"
)
print(f"copying file: {copycssfile}")
print(f"to folder: {newcssfolder}")

8
verse/forms/admindistribusiform.py

@ -1,9 +1,7 @@
"""Form object declaration."""
from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
SubmitField,
)
from wtforms import BooleanField, SubmitField
class AdminDistribusiForm(FlaskForm):
@ -15,7 +13,7 @@ class AdminDistribusiForm(FlaskForm):
class DistribusiListForm(AdminDistribusiForm):
pass
for (i, distribusi) in enumerate(distribusis):
for i, distribusi in enumerate(distribusis):
setattr(
DistribusiListForm,
f"distribusi_{i}",

8
verse/forms/adminuserform.py

@ -1,9 +1,7 @@
"""Form object declaration."""
from flask_wtf import FlaskForm
from wtforms import (
SubmitField,
BooleanField,
)
from wtforms import BooleanField, SubmitField
class AdminUserForm(FlaskForm):
@ -13,7 +11,7 @@ class AdminUserForm(FlaskForm):
class UserListForm(AdminUserForm):
pass
for (i, user) in enumerate(users):
for i, user in enumerate(users):
setattr(
UserListForm,
f"user_{i}",

13
verse/forms/editorform.py

@ -1,15 +1,10 @@
"""Form to save your CSS editor work."""
from wtforms import (
StringField,
TextAreaField,
BooleanField,
SubmitField,
)
from wtforms import validators
from wtforms.validators import Length
from flask_wtf.file import FileField, FileAllowed, FileSize
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed, FileField, FileSize
from wtforms import (BooleanField, StringField, SubmitField, TextAreaField,
validators)
from wtforms.validators import Length
class EditorForm(FlaskForm):

8
verse/forms/forgotpasswordform.py

@ -1,12 +1,8 @@
"""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):

9
verse/forms/loginform.py

@ -1,13 +1,8 @@
"""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):

6
verse/forms/publicthemeform.py

@ -1,9 +1,7 @@
"""Form object declaration."""
from flask_wtf import FlaskForm
from wtforms import (
RadioField,
SubmitField,
)
from wtforms import RadioField, SubmitField
class PublicThemeForm(FlaskForm):

13
verse/forms/registerform.py

@ -1,13 +1,8 @@
"""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):
@ -29,7 +24,7 @@ class RegisterForm(FlaskForm):
Email(),
Length(6, 64),
hremail,
]
],
)
password = PasswordField(

8
verse/forms/resetpasswordform.py

@ -1,12 +1,8 @@
"""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):

2
verse/forms/selectorform.py

@ -1,5 +1,5 @@
from flask_wtf import FlaskForm
from wtforms import SubmitField, SelectField
from wtforms import SelectField, SubmitField
class SelectorForm(FlaskForm):

6
verse/forms/themeform.py

@ -1,9 +1,7 @@
"""Form object declaration."""
from flask_wtf import FlaskForm
from wtforms import (
RadioField,
SubmitField,
)
from wtforms import RadioField, SubmitField
class ThemeForm(FlaskForm):

59
verse/forms/uploadform.py

@ -1,18 +1,9 @@
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed, FileRequired, FileSize
from wtforms import validators
from wtforms.validators import (
Length,
NumberRange,
DataRequired,
ValidationError,
)
from wtforms import (
SubmitField,
StringField,
IntegerField,
SelectField,
)
from flask_wtf.file import FileAllowed, FileField, FileRequired, FileSize
from wtforms import (IntegerField, SelectField, StringField, SubmitField,
validators)
from wtforms.validators import (DataRequired, Length, NumberRange,
ValidationError)
class UploadForm(FlaskForm):
@ -24,40 +15,44 @@ class UploadForm(FlaskForm):
sitename = StringField(
"Name of your archive section:",
validators=[validators.InputRequired(), Length(2, 100), _distribusiname],
validators=[
validators.InputRequired(),
Length(2, 100),
_distribusiname,
],
)
year = SelectField(
"Year:",
validate_choice=True,
coerce=str,
choices=[
(u'2017', u'2017'),
(u'2018', u'2018'),
(u'2019', u'2019'),
(u'2020', u'2020'),
(u'2021', u'2021'),
(u'2022', u'2022'),
(u'2023', u'2023'),
(u'2024', u'2024'),
(u'2025', u'2025'),
("2017", "2017"),
("2018", "2018"),
("2019", "2019"),
("2020", "2020"),
("2021", "2021"),
("2022", "2022"),
("2023", "2023"),
("2024", "2024"),
("2025", "2025"),
],
option_widget=None,
validators=[DataRequired()]
validators=[DataRequired()],
)
category = SelectField(
"Category:",
validate_choice=True,
coerce=str,
choices=[
(u'event', u'event'),
(u'gathering', u'gathering'),
(u'work session', u'work session'),
(u'workgroup', u'workgroup'),
(u'performance', u'performance'),
(u'music event', u'music event'),
("event", "event"),
("gathering", "gathering"),
("work session", "work session"),
("workgroup", "workgroup"),
("performance", "performance"),
("music event", "music event"),
],
option_widget=None,
validators=[DataRequired()]
validators=[DataRequired()],
)
tags = StringField(
"Add tags, seperated by commas. No need for the '#' sign:",

23
verse/migrations/env.py

@ -3,9 +3,8 @@ from __future__ import with_statement
import logging
from logging.config import fileConfig
from flask import current_app
from alembic import context
from flask import current_app
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@ -14,17 +13,19 @@ config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logger = logging.getLogger('alembic.env')
logger = logging.getLogger("alembic.env")
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
config.set_main_option(
'sqlalchemy.url',
str(current_app.extensions['migrate'].db.get_engine().url).replace(
'%', '%%'))
target_metadata = current_app.extensions['migrate'].db.metadata
"sqlalchemy.url",
str(current_app.extensions["migrate"].db.get_engine().url).replace(
"%", "%%"
),
)
target_metadata = current_app.extensions["migrate"].db.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
@ -65,20 +66,20 @@ def run_migrations_online():
# when there are no changes to the schema
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
def process_revision_directives(context, revision, directives):
if getattr(config.cmd_opts, 'autogenerate', False):
if getattr(config.cmd_opts, "autogenerate", False):
script = directives[0]
if script.upgrade_ops.is_empty():
directives[:] = []
logger.info('No changes in schema detected.')
logger.info("No changes in schema detected.")
connectable = current_app.extensions['migrate'].db.get_engine()
connectable = current_app.extensions["migrate"].db.get_engine()
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions['migrate'].configure_args
**current_app.extensions["migrate"].configure_args,
)
with context.begin_transaction():

23
verse/models/distribusimodel.py

@ -0,0 +1,23 @@
from app import db
class Distribusis(db.Model):
"""distribusi model class for a single distribusi in distribusi-verse"""
__tablename__ = "distribusis"
id = db.Column(db.Integer, primary_key=True)
distribusiname = db.Column(db.String(300), nullable=False, unique=True)
userid = db.Column(db.Integer, db.ForeignKey("users.id"))
term = db.Column(db.String(5), nullable=False, unique=False)
category = db.Column(db.String(500), nullable=True, unique=False)
# Academic year eg:2020-2021, so no need for a Datetime object
year = db.Column(db.String(9), nullable=True, unique=False)
tags = db.Column(db.String(500), nullable=True, unique=False)
publictheme = db.Column(db.String(300), unique=True, nullable=True)
visible = db.Column(db.Boolean, default=False)
def __repr__(self):
return "<Distribusi %r>" % self.distribusiname

23
verse/models/usermodel.py

@ -0,0 +1,23 @@
from flask_login import UserMixin
from app import db
class User(UserMixin, db.Model):
"""User model class for a user in distribusi-verse"""
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(150), unique=True, nullable=False)
email = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(300), nullable=False, unique=False)
currentdistribusi = db.Column(db.String(300), nullable=True, unique=False)
resethash = db.Column(db.String(300), nullable=True, unique=True)
resettime = db.Column(db.DateTime)
# active = db.Column(db.Boolean, default=False)
tutor = db.Column(db.Boolean, default=False)
admin = db.Column(db.Boolean, default=False)
def __repr__(self):
return "<User %r>" % self.email

48
verse/start.py

@ -1,45 +1,33 @@
"""This is the main flask distribusi page"""
from datetime import timedelta
from flask import (
render_template,
redirect,
url_for,
session,
send_from_directory,
Blueprint,
)
from flask_login import (
logout_user,
login_required,
current_user,
)
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 app import create_app, login_manager
from usermodel import User
from distribusimodel import Distribusis
# Use upload form to populate filters
from forms.uploadform import UploadForm
# Interface! these are seperate files in main folder
from adminpage import AdminPage
from editor import Editor
from themeselector import ThemeSelector
from distribusiworkflow import DistribusiWorkflow
from app import create_app, login_manager
from distribusiselector import DistribusiSelector
from uploadpage import UploadPage
# Distribusi Information
from distribusisinfo import DistribusisInfo
from distribusiworkflow import DistribusiWorkflow
from editor import Editor
# Use upload form to populate filters
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from statuspengguna.forgotpassword import ForgotPassword
# UserPengguna
from statuspengguna.helper import UserHelper
from statuspengguna.loginuser import LoginUser
from statuspengguna.registeruser import RegisterUser
from statuspengguna.forgotpassword import ForgotPassword
from statuspengguna.resetpassword import ResetPassword
# Distribusi Information
from distribusisinfo import DistribusisInfo
from themeselector import ThemeSelector
from uploadpage import UploadPage
APP = create_app()
stash_page = Blueprint("stash_page", __name__, static_folder="stash")
@ -56,7 +44,6 @@ def session_handler():
@APP.route("/")
def index():
UserHelper.reset_user_state()
# http://localhost:5000/themes/publicthemes/RomeroTape/blueskies.css
uploadform = UploadForm()
distribusis = DistribusisInfo.visibledistribusis()
distribusisindex = {}
@ -66,7 +53,6 @@ def index():
"username": user.username,
"publictheme": distribusi.publictheme,
"category": distribusi.term,
"course": distribusi.course,
"year": distribusi.year,
"tags": distribusi.tags.split(","),
}

15
verse/statuspengguna/forgotpassword.py

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

17
verse/statuspengguna/helper.py

@ -1,17 +1,14 @@
import os
from flask_login import current_user
from flask import flash
from sqlalchemy.exc import (
DataError,
DatabaseError,
InterfaceError,
InvalidRequestError,
)
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from usermodel import User
from distribusimodel import Distribusis
from distribusisinfo import DistribusisInfo
from app import db
from distribusisinfo import DistribusisInfo
from models.distribusimodel import Distribusis
from models.usermodel import User
class UserHelper:

16
verse/statuspengguna/loginuser.py

@ -1,15 +1,9 @@
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 models.usermodel import User
def LoginUser():

25
verse/statuspengguna/registeruser.py

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

26
verse/statuspengguna/resetpassword.py

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

12
verse/themeselector.py

@ -1,15 +1,15 @@
import os
import shutil
from flask import render_template
from statuspengguna.helper import UserHelper
from distribusisinfo import DistribusisInfo
from forms.uploadform import UploadForm
from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from statuspengguna.helper import UserHelper
def ThemeSelector():
@ -30,9 +30,7 @@ def ThemeSelector():
)
MoveCssToUserFolder(current_distribusi, copycssfile)
return RenderDistribusiTemplate(
themeform,
publicthemeform,
current_distribusi
themeform, publicthemeform, current_distribusi
)

19
verse/upload.py

@ -1,22 +1,17 @@
import os
import shutil
from flask import flash
from flask_login import current_user
from sqlalchemy.exc import (
IntegrityError,
InvalidRequestError,
DataError,
InterfaceError,
DatabaseError,
)
from app import db
from usermodel import User
from distribusimodel import Distribusis
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
from statuspengguna.helper import UserHelper
from app import db
from distribusiselector import SelectCurrentDistribusi
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from statuspengguna.helper import UserHelper
def UploadNewDistribusi(uploadfolder):

8
verse/uploadpage.py

@ -1,16 +1,14 @@
from flask import render_template
from distribusiselector import SelectorVisible
from distribusisinfo import DistribusisInfo
from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
# UserPengguna
from statuspengguna.helper import UserHelper
from upload import UploadNewDistribusi, UploadUpdatedFiles
from distribusisinfo import DistribusisInfo
from distribusiselector import SelectorVisible
def UploadPage(uploadfolder):

Loading…
Cancel
Save