update packages
This commit is contained in:
@@ -5,7 +5,6 @@ from flask_assets import Environment
|
||||
from webassets import Bundle
|
||||
import time
|
||||
from app.models import db, migrate, PlayKey
|
||||
from app.schemas import ma
|
||||
from app.forms import CustomUserManager
|
||||
from flask_user import user_registered, current_user, user_logged_in
|
||||
from flask_wtf.csrf import CSRFProtect
|
||||
@@ -128,8 +127,6 @@ def register_extensions(app):
|
||||
"""
|
||||
db.init_app(app)
|
||||
migrate.init_app(app, db)
|
||||
ma.init_app(app)
|
||||
|
||||
scheduler.init_app(app)
|
||||
scheduler.start()
|
||||
|
||||
|
@@ -19,16 +19,12 @@ from app.models import (
|
||||
db,
|
||||
Friends
|
||||
)
|
||||
from app.schemas import AccountSchema
|
||||
from app import gm_level, log_audit
|
||||
from app.forms import EditGMLevelForm, EditEmailForm
|
||||
from sqlalchemy import or_
|
||||
|
||||
accounts_blueprint = Blueprint('accounts', __name__)
|
||||
|
||||
account_schema = AccountSchema()
|
||||
|
||||
|
||||
@accounts_blueprint.route('/', methods=['GET'])
|
||||
@login_required
|
||||
@gm_level(3)
|
||||
|
@@ -3,7 +3,6 @@ from flask_user import login_required, current_user
|
||||
from datatables import ColumnDT, DataTables
|
||||
import time
|
||||
from app.models import CharacterInfo, CharacterXML, Account, db
|
||||
from app.schemas import CharacterInfoSchema
|
||||
from app.forms import RescueForm, CharXMLUploadForm
|
||||
from app import gm_level, log_audit
|
||||
from app.luclient import translate_from_locale
|
||||
@@ -15,9 +14,6 @@ from xml.dom import minidom
|
||||
|
||||
character_blueprint = Blueprint('characters', __name__)
|
||||
|
||||
character_schema = CharacterInfoSchema()
|
||||
|
||||
|
||||
@character_blueprint.route('/', methods=['GET'])
|
||||
@login_required
|
||||
@gm_level(3)
|
||||
|
@@ -2,16 +2,12 @@ from flask import render_template, Blueprint, send_from_directory
|
||||
from flask_user import current_user, login_required
|
||||
|
||||
from app.models import Account, CharacterInfo, ActivityLog
|
||||
from app.schemas import AccountSchema, CharacterInfoSchema
|
||||
|
||||
import datetime
|
||||
import time
|
||||
|
||||
main_blueprint = Blueprint('main', __name__)
|
||||
|
||||
account_schema = AccountSchema()
|
||||
char_info_schema = CharacterInfoSchema()
|
||||
|
||||
|
||||
@main_blueprint.route('/', methods=['GET'])
|
||||
def index():
|
||||
|
@@ -4,7 +4,7 @@ from flask_user import UserMixin
|
||||
from wtforms import ValidationError
|
||||
|
||||
import logging
|
||||
from flask_sqlalchemy import BaseQuery
|
||||
from flask_sqlalchemy.query import Query
|
||||
from sqlalchemy.dialects import mysql
|
||||
from sqlalchemy.exc import OperationalError, StatementError
|
||||
from sqlalchemy.types import JSON
|
||||
@@ -15,7 +15,7 @@ import string
|
||||
|
||||
# retrying query to work around python trash collector
|
||||
# killing connections of other gunicorn workers
|
||||
class RetryingQuery(BaseQuery):
|
||||
class RetryingQuery(Query):
|
||||
__retry_count__ = 3
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@@ -13,7 +13,6 @@ from flask_user import login_required, current_user
|
||||
from datatables import ColumnDT, DataTables
|
||||
import time
|
||||
from app.models import Property, db, UGC, CharacterInfo, PropertyContent, Account, Mail
|
||||
from app.schemas import PropertySchema
|
||||
from app import gm_level, log_audit
|
||||
from app.luclient import query_cdclient
|
||||
from app.forms import RejectPropertyForm
|
||||
@@ -24,9 +23,6 @@ import pathlib
|
||||
|
||||
property_blueprint = Blueprint('properties', __name__)
|
||||
|
||||
property_schema = PropertySchema()
|
||||
|
||||
|
||||
@property_blueprint.route('/', methods=['GET'])
|
||||
@login_required
|
||||
@gm_level(3)
|
||||
|
130
app/schemas.py
130
app/schemas.py
@@ -1,130 +0,0 @@
|
||||
from flask_marshmallow import Marshmallow
|
||||
from app.models import (
|
||||
PlayKey,
|
||||
PetNames,
|
||||
Mail,
|
||||
UGC,
|
||||
PropertyContent,
|
||||
Property,
|
||||
CharacterXML,
|
||||
CharacterInfo,
|
||||
Account,
|
||||
AccountInvitation,
|
||||
ActivityLog,
|
||||
CommandLog
|
||||
)
|
||||
ma = Marshmallow()
|
||||
|
||||
|
||||
class PlayKeySchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = PlayKey
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = True
|
||||
|
||||
|
||||
class PetNamesSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = PetNames
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
|
||||
class MailSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Mail
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
|
||||
class UGCSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = UGC
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
|
||||
class PropertyContentSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = PropertyContent
|
||||
include_relationships = True
|
||||
load_instance = True
|
||||
include_fk = True
|
||||
|
||||
ugc = ma.Nested(UGCSchema)
|
||||
|
||||
|
||||
class PropertySchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Property
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
properties_contents = ma.Nested(PropertyContentSchema, many=True)
|
||||
|
||||
|
||||
class CharacterXMLSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = CharacterXML
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
|
||||
class CharacterInfoSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = CharacterInfo
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
charxml = ma.Nested(CharacterXMLSchema)
|
||||
properties_owner = ma.Nested(PropertySchema, many=True)
|
||||
pets = ma.Nested(PetNamesSchema, many=True)
|
||||
mail = ma.Nested(MailSchema, many=True)
|
||||
|
||||
|
||||
class AccountSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Account
|
||||
include_relationships = False
|
||||
load_instance = True
|
||||
include_fk = False
|
||||
|
||||
play_key = ma.Nested(PlayKeySchema)
|
||||
charinfo = ma.Nested(CharacterInfoSchema, many=True)
|
||||
|
||||
|
||||
class AccountInvitationSchema(ma.SQLAlchemyAutoSchema): # noqa
|
||||
class Meta:
|
||||
model = AccountInvitation
|
||||
include_relationships = True
|
||||
load_instance = True
|
||||
include_fk = True
|
||||
|
||||
invite_by_user = ma.Nested(AccountSchema)
|
||||
|
||||
|
||||
class ActivityLogSchema(ma.SQLAlchemyAutoSchema): # noqa
|
||||
class Meta:
|
||||
model = ActivityLog
|
||||
include_relationships = True
|
||||
load_instance = True
|
||||
include_fk = True
|
||||
|
||||
character = ma.Nested(CharacterInfoSchema())
|
||||
|
||||
|
||||
class CommandLogSchema(ma.SQLAlchemyAutoSchema): # noqa
|
||||
class Meta:
|
||||
model = CommandLog
|
||||
include_relationships = True
|
||||
load_instance = True
|
||||
include_fk = True
|
||||
|
||||
character = ma.Nested(CharacterInfoSchema())
|
Reference in New Issue
Block a user