replace print with log
This commit is contained in:
parent
c6ed9d8416
commit
856f88b15e
@ -112,7 +112,6 @@ def get_distribusi_file_forms(distribusi_id):
|
|||||||
def save_described_file_to_db(describe_form, distribusi_file):
|
def save_described_file_to_db(describe_form, distribusi_file):
|
||||||
try:
|
try:
|
||||||
if describe_form.description.data:
|
if describe_form.description.data:
|
||||||
print(distribusi_file.id)
|
|
||||||
distribusi_file.description = describe_form.description.data
|
distribusi_file.description = describe_form.description.data
|
||||||
if describe_form.alttext.data:
|
if describe_form.alttext.data:
|
||||||
distribusi_file.alttext = describe_form.alttext.data
|
distribusi_file.alttext = describe_form.alttext.data
|
||||||
|
@ -12,7 +12,7 @@ from sqlalchemy.exc import (
|
|||||||
)
|
)
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from app import db
|
from app import db, APP
|
||||||
from distribusikan.distribusis_info import DistribusisInfo
|
from distribusikan.distribusis_info import DistribusisInfo
|
||||||
from distribusikan.forms.distribusiform import DistribusiForm
|
from distribusikan.forms.distribusiform import DistribusiForm
|
||||||
from distribusikan.forms.editorform import EditorForm
|
from distribusikan.forms.editorform import EditorForm
|
||||||
@ -92,8 +92,7 @@ def copy_public_to_user_folder(editorform, publicfolder, newcssfolder):
|
|||||||
copycssfile = os.path.join(
|
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}")
|
APP.logger.info(f"copying file:{copycssfile} to folder:{newcssfolder}")
|
||||||
print(f"to folder: {newcssfolder}")
|
|
||||||
shutil.copy(copycssfile, newcssfolder)
|
shutil.copy(copycssfile, newcssfolder)
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from sqlalchemy.exc import (
|
|||||||
InvalidRequestError,
|
InvalidRequestError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from app import db
|
from app import db, APP
|
||||||
from distribusikan.distribusis_info import DistribusisInfo
|
from distribusikan.distribusis_info import DistribusisInfo
|
||||||
from distribusikan.forms.distribusiform import DistribusiForm
|
from distribusikan.forms.distribusiform import DistribusiForm
|
||||||
from distribusikan.forms.publicthemeform import PublicThemeForm
|
from distribusikan.forms.publicthemeform import PublicThemeForm
|
||||||
@ -66,7 +66,7 @@ def auto_fill_in_upload_form(uploadform, current_distribusi):
|
|||||||
|
|
||||||
|
|
||||||
def select_new_distribusi():
|
def select_new_distribusi():
|
||||||
print("make a new distribusi")
|
APP.logger.info("make a new distribusi")
|
||||||
select_current_distribusi("new")
|
select_current_distribusi("new")
|
||||||
|
|
||||||
|
|
||||||
@ -80,12 +80,11 @@ def select_describe_distribusi(distribusiname):
|
|||||||
|
|
||||||
|
|
||||||
def select_update_distribusi(distribusiname):
|
def select_update_distribusi(distribusiname):
|
||||||
print(f"Update this distribusi {distribusiname}")
|
|
||||||
select_current_distribusi(distribusiname)
|
select_current_distribusi(distribusiname)
|
||||||
|
|
||||||
|
|
||||||
def delete_distribusi(distribusiname):
|
def delete_distribusi(distribusiname):
|
||||||
print(f"delete this distribusi {distribusiname}")
|
APP.logger.info(f"attempt to delete distribusi:{distribusiname}")
|
||||||
selectorform = SelectorForm()
|
selectorform = SelectorForm()
|
||||||
try:
|
try:
|
||||||
user = User.query.filter_by(email=current_user.email).first()
|
user = User.query.filter_by(email=current_user.email).first()
|
||||||
@ -95,13 +94,11 @@ def delete_distribusi(distribusiname):
|
|||||||
if distribusi.userid is user.id:
|
if distribusi.userid is user.id:
|
||||||
db.session.delete(distribusi)
|
db.session.delete(distribusi)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
# SelectField error is list is a tuple?? why??
|
|
||||||
# selectorform.distribusis.errors.append("Distribusi deleted!")
|
|
||||||
except (InvalidRequestError, DataError, InterfaceError, DatabaseError):
|
except (InvalidRequestError, DataError, InterfaceError, DatabaseError):
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
# selectorform.distribusis.errors.append("Unknown error occured!")
|
|
||||||
flash("An error occured !", "danger")
|
flash("An error occured !", "danger")
|
||||||
_delete_distribusi_files(distribusi.distribusiname)
|
_delete_distribusi_files(distribusi.distribusiname)
|
||||||
|
APP.logger.info(f"deleted distribusi:{distribusiname}")
|
||||||
return selectorform
|
return selectorform
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ def LoginUser():
|
|||||||
flash("Logged in successfully.", "success")
|
flash("Logged in successfully.", "success")
|
||||||
next = request.args.get("next")
|
next = request.args.get("next")
|
||||||
if next is not None and not is_safe_url(next): # noqa: F821
|
if next is not None and not is_safe_url(next): # noqa: F821
|
||||||
print(next)
|
|
||||||
return abort(400)
|
return abort(400)
|
||||||
print("index")
|
print("index")
|
||||||
return redirect(next or url_for("index"))
|
return redirect(next or url_for("index"))
|
||||||
|
Loading…
Reference in New Issue
Block a user