IT HAS BEGUN

This commit is contained in:
Aaron Kimbre 2022-05-29 01:49:19 -05:00
parent a5ea052027
commit 1b4887f73e
4 changed files with 7339 additions and 23 deletions

View File

@ -1,5 +1,5 @@
import os import os
from flask import Flask, url_for, g, redirect from flask import Flask, url_for, redirect
from functools import wraps from functools import wraps
from flask_assets import Environment from flask_assets import Environment
from webassets import Bundle from webassets import Bundle
@ -25,8 +25,6 @@ from app.models import Account, AccountInvitation, AuditLog
import logging import logging
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
from werkzeug.exceptions import HTTPException
# Instantiate Flask extensions # Instantiate Flask extensions
csrf_protect = CSRFProtect() csrf_protect = CSRFProtect()
scheduler = APScheduler() scheduler = APScheduler()
@ -76,12 +74,6 @@ def create_app():
def debug(text): def debug(text):
print(text) print(text)
@app.teardown_appcontext
def close_connection(exception):
cdclient = getattr(g, '_cdclient', None)
if cdclient is not None:
cdclient.close()
# add the commands to flask cli # add the commands to flask cli
app.cli.add_command(init_db) app.cli.add_command(init_db)
app.cli.add_command(init_accounts) app.cli.add_command(init_accounts)
@ -194,6 +186,9 @@ def register_settings(app):
'APP_DATABASE_URI', 'APP_DATABASE_URI',
app.config['APP_DATABASE_URI'] app.config['APP_DATABASE_URI']
) )
app.config['SQLALCHEMY_BINDS'] = {
'cdclient': 'sqlite:///luclient/res/cdclient.sqlite'
}
# try to get overides, otherwise just use what we have already # try to get overides, otherwise just use what we have already
app.config['USER_ENABLE_REGISTER'] = os.getenv( app.config['USER_ENABLE_REGISTER'] = os.getenv(
@ -224,14 +219,6 @@ def register_settings(app):
'ALLOW_ANALYTICS', 'ALLOW_ANALYTICS',
app.config['ALLOW_ANALYTICS'] app.config['ALLOW_ANALYTICS']
) )
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
"pool_pre_ping": True,
"pool_size": 10,
"max_overflow": 2,
"pool_recycle": 300,
"pool_pre_ping": True,
"pool_use_lifo": True
}
app.config['MAIL_SERVER'] = os.getenv( app.config['MAIL_SERVER'] = os.getenv(
'MAIL_SERVER', 'MAIL_SERVER',
app.config['MAIL_SERVER'] app.config['MAIL_SERVER']

7331
app/cdclient.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ from flask import (
) )
from flask_user import login_required from flask_user import login_required
from app.models import CharacterInfo from app.models import CharacterInfo
from app.cdclient import Objects
import glob import glob
import os import os
from wand import image from wand import image
@ -247,13 +248,9 @@ def get_lot_name(lot_id):
return "Missing" return "Missing"
name = translate_from_locale(f'Objects_{lot_id}_name') name = translate_from_locale(f'Objects_{lot_id}_name')
if name == f'Objects_{lot_id}_name': if name == f'Objects_{lot_id}_name':
intermed = query_cdclient( intermed = Objects.query.filter(Objects.id == lot_id).first()
'select * from Objects where id = ?',
[lot_id],
one=True
)
if intermed: if intermed:
name = intermed[7] if (intermed[7] != "None" and intermed[7] != "" and intermed[7] is None) else intermed[1] name = intermed.displayName if (intermed.displayName != "None" and intermed.displayName != "" and intermed.displayName is None) else intermed.name
return name return name

View File

@ -49,6 +49,7 @@ six==1.16.0
snowballstemmer==2.2.0 snowballstemmer==2.2.0
SQLAlchemy==1.4.22 SQLAlchemy==1.4.22
sqlalchemy-datatables==2.0.1 sqlalchemy-datatables==2.0.1
SQLAlchemy-Utils==0.38.2
toml==0.10.2 toml==0.10.2
tzdata==2021.5 tzdata==2021.5
tzlocal==4.1 tzlocal==4.1