From f7703abe5ed233acae7985093eea4f02a3246d79 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sun, 29 May 2022 20:12:32 -0500 Subject: [PATCH] Progress --- app/cdclient.py | 174 ++++++++++++++++++++++++++-------------------- app/luclient.py | 67 +++++------------- app/mail.py | 12 ++-- app/properties.py | 42 +++++------ 4 files changed, 135 insertions(+), 160 deletions(-) diff --git a/app/cdclient.py b/app/cdclient.py index 7d7d076..54aa2f2 100644 --- a/app/cdclient.py +++ b/app/cdclient.py @@ -167,7 +167,7 @@ class Activities(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -258,7 +258,7 @@ class ActivityText(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -1203,7 +1203,7 @@ class CelebrationParameters(db.Model): backgroundObject = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id) + db.ForeignKey("Objects.id"), nullable=False ) @@ -1224,7 +1224,7 @@ class CelebrationParameters(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -1380,7 +1380,7 @@ class CollectibleComponent(db.Model): requirement_mission = db.Column( sqlite.INTEGER(), - db.ForeignKey(Missions.id), + db.ForeignKey("Missions.id"), nullable=True ) @@ -1391,7 +1391,7 @@ class ComponentsRegistry(db.Model): id = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id) + db.ForeignKey("Objects.id"), nullable=False, primary_key=True ) @@ -1553,7 +1553,7 @@ class CurrencyDenominations(db.Model): objectid = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id) + db.ForeignKey("Objects.id"), nullable=False ) @@ -1644,7 +1644,7 @@ class DeletionRestrictions(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -1661,7 +1661,7 @@ class DestructibleComponent(db.Model): faction = db.Column( sqlite.INTEGER(), - db.ForeignKey(Factions.faction) + db.ForeignKey("Factions.faction"), nullable=True ) @@ -1791,7 +1791,7 @@ class Emotes(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -2335,37 +2335,37 @@ class ItemSets(db.Model): kitImage = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID) + db.ForeignKey("Icons.IconID"), nullable=True ) skillSetWith2 = db.Column( sqlite.INTEGER(), - db.ForeignKey(ItemSetSkills.id), + db.ForeignKey("ItemSetSkills.SkillSetID"), nullable=True ) skillSetWith3 = db.Column( sqlite.INTEGER(), - db.ForeignKey(ItemSetSkills.id), + db.ForeignKey("ItemSetSkills.SkillSetID"), nullable=True ) skillSetWith4 = db.Column( sqlite.INTEGER(), - db.ForeignKey(ItemSetSkills.id), + db.ForeignKey("ItemSetSkills.SkillSetID"), nullable=True ) skillSetWith5 = db.Column( sqlite.INTEGER(), - db.ForeignKey(ItemSetSkills.id), + db.ForeignKey("ItemSetSkills.SkillSetID"), nullable=True ) skillSetWith6 = db.Column( sqlite.INTEGER(), - db.ForeignKey(ItemSetSkills.id), + db.ForeignKey("ItemSetSkills.SkillSetID"), nullable=True ) @@ -2376,7 +2376,7 @@ class ItemSets(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) # ??? @@ -2418,13 +2418,13 @@ class JetPackPadComponent(db.Model): lotBlocker = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id), + db.ForeignKey("Objects.id"), nullable=True ) lotWarningVolume = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id), + db.ForeignKey("Objects.id"), nullable=True ) @@ -2476,7 +2476,7 @@ class LUPExhibitModelData(db.Model): LOT = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id), + db.ForeignKey("Objects.id"), nullable=False, primary_key=True ) @@ -2513,7 +2513,7 @@ class LUPZoneIDs(db.Model): zoneID = db.Column( sqlite.INTEGER(), - db.ForeignKey(ZoneTabe.zoneID) + db.ForeignKey("ZoneTable.zoneID"), nullable=False, primary_key=True ) @@ -2561,6 +2561,7 @@ class LootMatrix(db.Model): __tablename__ = 'LootMatrix' __bind_key__ = 'cdclient' + # FK? LootMatrixIndex = db.Column( sqlite.INTEGER(), nullable=False, @@ -2606,7 +2607,7 @@ class LootMatrix(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -2694,7 +2695,7 @@ class MinifigComponent(db.Model): legs = db.Column( sqlite.INTEGER(), - db.ForeignKey(MinifigDecals_Legs.id), + db.ForeignKey("MinifigDecals_Legs.ID"), nullable=False ) @@ -2710,7 +2711,7 @@ class MinifigComponent(db.Model): chestdecal = db.Column( sqlite.INTEGER(), - db.ForeignKey(MinifigDecals_Torsos.id), + db.ForeignKey("MinifigDecals_Torsos.ID"), nullable=False ) @@ -2731,19 +2732,19 @@ class MinifigComponent(db.Model): eyebrowstyle = db.Column( sqlite.INTEGER(), - db.ForeignKey(MinifigDecals_Eyebrows.id), + db.ForeignKey("MinifigDecals_Eyebrows.ID"), nullable=False ) eyesstyle = db.Column( sqlite.INTEGER(), - db.ForeignKey(MinifigDecals_Eyes.id), + db.ForeignKey("MinifigDecals_Eyes.ID"), nullable=False ) mouthstyle = db.Column( sqlite.INTEGER(), - db.ForeignKey(MinifigDecals_Mouths.id), + db.ForeignKey("MinifigDecals_Mouths.ID"), nullable=False ) @@ -2925,7 +2926,7 @@ class MissionEmail(db.Model): missionID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Missions.id), + db.ForeignKey("Missions.id"), nullable=False ) @@ -2933,7 +2934,7 @@ class MissionEmail(db.Model): attachmentLOT = db.Column( sqlite.INTEGER(), - db.ForeignKey(Objects.id), + db.ForeignKey("Objects.id"), nullable=True ) @@ -2951,7 +2952,7 @@ class MissionEmail(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -2968,7 +2969,7 @@ class MissionNPCComponent(db.Model): missionID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Missions.id), + db.ForeignKey("Missions.id"), nullable=False ) @@ -2984,7 +2985,7 @@ class MissionNPCComponent(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -3036,7 +3037,7 @@ class MissionTasks(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -3059,7 +3060,7 @@ class MissionTasks(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -3091,7 +3092,7 @@ class MissionText(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -3219,7 +3220,7 @@ class MissionText(db.Model): turnInIconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -3237,7 +3238,7 @@ class MissionText(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -3296,9 +3297,10 @@ class Missions(db.Model): sqlite.BOOLEAN(), nullable=False ) - # FK + reward_item1 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3306,9 +3308,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item2 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3316,9 +3319,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item3 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3326,9 +3330,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item4 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3336,24 +3341,28 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_emote = db.Column( sqlite.INTEGER(), + db.ForeignKey("Emotes.id"), nullable=False ) - # FK + reward_emote2 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Emotes.id"), nullable=False ) - # FK + reward_emote3 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Emotes.id"), nullable=True ) - # FK + reward_emote4 = db.Column( sqlite.INTEGER(), + db.ForeignKey("Emotes.id"), nullable=True ) @@ -3396,9 +3405,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=True ) - # FK + reward_item1_repeatable = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3406,9 +3416,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item2_repeatable = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3416,9 +3427,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item3_repeatable = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3426,9 +3438,10 @@ class Missions(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + reward_item4_repeatable = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3449,12 +3462,13 @@ class Missions(db.Model): missionIconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) missionIcon = db.relationship("Icons") - # FK + + # pipe SV of missions? prereqMissionID = db.Column( sqlite.TEXT(), nullable=True @@ -3484,15 +3498,15 @@ class Missions(db.Model): sqlite.TEXT(), nullable=True ) - # FK + # FK ? UIPrereqID = db.Column( sqlite.INTEGER(), nullable=True ) - # FK + gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -3550,6 +3564,7 @@ class ModularBuildComponent(db.Model): createdLOT = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3777,9 +3792,10 @@ class NpcIcons(db.Model): sqlite.FLOAT(), nullable=False ) - # FK + LOT = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False ) @@ -3902,12 +3918,14 @@ class ObjectSkills(db.Model): objectTemplate = db.Column( sqlite.INTEGER(), + db.ForeignKey("Objects.id"), nullable=False, primary_key=True ) - # FK + skillID = db.Column( sqlite.INTEGER(), + db.ForeignKey("SkillBehavior.skillID"), nullable=False ) @@ -3956,7 +3974,7 @@ class Objects(db.Model): sqlite.BOOLEAN(), nullable=False ) - + # FK? npcTemplateID = db.Column( sqlite.INTEGER(), nullable=True @@ -3989,7 +4007,7 @@ class Objects(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -4008,13 +4026,14 @@ class PackageComponent(db.Model): nullable=False, primary_key=True ) - # FK + LootMatrixIndex = db.Column( sqlite.INTEGER(), + db.ForeignKey("LootMatrix.LootMatrixIndex"), nullable=False, primary_key=True ) - + # Enum? packageType = db.Column( sqlite.INTEGER(), nullable=False @@ -4122,6 +4141,7 @@ class PetComponent(db.Model): nullable=True ) + # CSV of BuffDefinitions.ID's ? buffIDs = db.Column( sqlite.TEXT(), nullable=True @@ -4275,10 +4295,10 @@ class PlayerStatistics(db.Model): sqlite.INTEGER(), nullable=False ) - # FK + gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -4396,7 +4416,7 @@ class Preconditions(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -4419,7 +4439,7 @@ class Preconditions(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -4469,7 +4489,7 @@ class PropertyTemplate(db.Model): sqlite.INTEGER(), nullable=False ) - # FK ZoneTabe + # FK ZoneTable vendorMapID = db.Column( sqlite.INTEGER(), nullable=False @@ -4557,7 +4577,7 @@ class PropertyTemplate(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -4620,7 +4640,7 @@ class ProximityTypes(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -4961,7 +4981,7 @@ class RenderComponent(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -5215,7 +5235,7 @@ class RewardCodes(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -5457,7 +5477,7 @@ class SkillBehavior(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -5616,7 +5636,7 @@ class SpeedchatMenu(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -5950,7 +5970,7 @@ class UGBehaviorSounds(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -6555,7 +6575,7 @@ class WhatsCoolItemSpotlight(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -6577,7 +6597,7 @@ class WhatsCoolNewsAndTips(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False ) @@ -6595,7 +6615,7 @@ class WhatsCoolNewsAndTips(db.Model): # FK gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -7101,7 +7121,7 @@ class ZoneTable(db.Model): gate_version = db.Column( sqlite.TEXT(), - db.ForeignKey(FeatureGating.featureName), + db.ForeignKey("FeatureGating.featureName"), nullable=True ) @@ -7238,7 +7258,7 @@ class mapIcon(db.Model): IconID = db.Column( sqlite.INTEGER(), - db.ForeignKey(Icons.IconID), + db.ForeignKey("Icons.IconID"), nullable=False, primary_key=True ) diff --git a/app/luclient.py b/app/luclient.py index 53971c2..e15d59c 100644 --- a/app/luclient.py +++ b/app/luclient.py @@ -9,7 +9,11 @@ from flask import ( ) from flask_user import login_required from app.models import CharacterInfo -from app.cdclient import Objects +from app.cdclient import ( + Objects, + Icons, + ItemSets +) import glob import os from wand import image @@ -19,6 +23,7 @@ import json import sqlite3 import xml.etree.ElementTree as ET +from sqlalchemy import or_ luclient_blueprint = Blueprint('luclient', __name__) locale = {} @@ -104,11 +109,7 @@ def get_icon_lot(id): @login_required def get_icon_iconid(id): - filename = query_cdclient( - 'select IconPath from Icons where IconID = ?', - [id], - one=True - )[0] + filename = Icons.query.filter(Icons.IconID == id).first().IconPath filename = filename.replace("..\\", "").replace("\\", "/") @@ -184,32 +185,6 @@ def unknown(): return send_file(pathlib.Path(cache).resolve()) -def get_cdclient(): - """Connect to CDClient from file system Relative Path - - Args: - None - """ - cdclient = getattr(g, '_cdclient', None) - if cdclient is None: - cdclient = g._database = sqlite3.connect('app/luclient/res/cdclient.sqlite') - return cdclient - - -def query_cdclient(query, args=(), one=False): - """Run sql queries on CDClient - - Args: - query (string) : SQL query - args (list) : List of args to place in query - one (bool) : Return only on result or all results - """ - cur = get_cdclient().execute(query, args) - rv = cur.fetchall() - cur.close() - return (rv[0] if rv else None) if one else rv - - def translate_from_locale(trans_string): """Finds the string translation from locale.xml @@ -322,11 +297,8 @@ def register_luclient_jinja_helpers(app): return "Missing" desc = translate_from_locale(f'Objects_{lot_id}_description') if desc == f'Objects_{lot_id}_description': - desc = query_cdclient( - 'select description from Objects where id = ?', - [lot_id], - one=True - ) + desc = Objects.query.filter(Objects.id == id).first().description + if desc in ("", None): desc = None else: @@ -341,11 +313,14 @@ def register_luclient_jinja_helpers(app): def check_if_in_set(lot_id): if not lot_id: return None - item_set = query_cdclient( - 'select * from ItemSets where itemIDs like ? or itemIDs like ? or itemIDs like ?', - [f'{lot_id}%', f'%, {lot_id}%', f'%,{lot_id}%'], - one=True - ) + item_set = ItemSets.query.filter( + or_( + ItemSets.itemIDs.like(f'{lot_id}%'), + ItemSets.itemIDs.like(f'%, {lot_id}%'), + ItemSets.itemIDs.like(f'%,{lot_id}%') + ) + ).first() + if item_set in ("", None): return None else: @@ -377,14 +352,6 @@ def register_luclient_jinja_helpers(app): return consolidate_stats(stats) - @app.template_filter('query_cdclient') - def jinja_query_cdclient(query, items): - print(query, items) - return query_cdclient( - query, - items, - one=True - )[0] @app.template_filter('lu_translate') def lu_translate(to_translate): diff --git a/app/mail.py b/app/mail.py index 7844c0b..75b03c5 100644 --- a/app/mail.py +++ b/app/mail.py @@ -3,7 +3,8 @@ from flask_user import login_required, current_user from app.models import Mail, CharacterInfo from app.forms import SendMailForm from app import gm_level, log_audit -from app.luclient import translate_from_locale, query_cdclient +from app.luclient import translate_from_locale +from app.cdclient import Objects import time mail_blueprint = Blueprint('mail', __name__) @@ -68,15 +69,12 @@ def send(): for character in recipients: form.recipient.choices.append((character.id, character.name)) - items = query_cdclient( - 'Select id, name, displayName from Objects where type = ?', - ["Loot"] - ) + items = Objects.query.filter(Objects.type == "Loot").all() for item in items: name = translate_from_locale(f'Objects_{item[0]}_name') - if name == f'Objects_{item[0]}_name': - name = (item[2] if (item[2] != "None" and item[2] != "" and item[2] is not None) else item[1]) + if name == f'Objects_{item.id}_name': + name = (item.displayName if (item.displayName != "None" and item.displayName != "" and item.displayName is not None) else item.name) form.attachment.choices.append( ( item[0], diff --git a/app/properties.py b/app/properties.py index 13e27b2..8646c64 100644 --- a/app/properties.py +++ b/app/properties.py @@ -15,7 +15,7 @@ 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.cdclient import ZoneTable from app.forms import RejectPropertyForm import zlib @@ -49,11 +49,9 @@ def approve(id): if property_data.mod_approved: message = f"""Approved Property - {property_data.name if property_data.name else query_cdclient( - 'select DisplayDescription from ZoneTable where zoneID = ?', - [property_data.zone_id], - one=True - )[0]} + {property_data.name if property_data.name else ZoneTable.query.filter( + ZoneTable.zoneID == property_data.zone_id + ).first().DisplayDescription} from {CharacterInfo.query.filter(CharacterInfo.id==property_data.owner_id).first().name}""" log_audit(message) flash( @@ -62,11 +60,9 @@ def approve(id): ) else: message = f"""Unapproved Property - {property_data.name if property_data.name else query_cdclient( - 'select DisplayDescription from ZoneTable where zoneID = ?', - [property_data.zone_id], - one=True - )[0]} + {property_data.name if property_data.name else ZoneTable.query.filter( + ZoneTable.zoneID == property_data.zone_id + ).first().DisplayDescription} from {CharacterInfo.query.filter(CharacterInfo.id==property_data.owner_id).first().name}""" log_audit(message) flash( @@ -100,11 +96,9 @@ def reject(id): if form.validate_on_submit(): char_name = CharacterInfo.query.filter(CharacterInfo.id == property_data.owner_id).first().name - zone_name = query_cdclient( - 'select DisplayDescription from ZoneTable where zoneID = ?', - [property_data.zone_id], - one=True - )[0] + zone_name = ZoneTable.query.filter( + ZoneTable.zoneID == property_data.zone_id + ).first().DisplayDescription property_data.mod_approved = False property_data.rejection_reason = form.rejection_reason.data message = f"""Rejected Property @@ -251,11 +245,9 @@ def get(status="all"): """ if property_data["4"] == "": - property_data["4"] = query_cdclient( - 'select DisplayDescription from ZoneTable where zoneID = ?', - [property_data["13"]], - one=True - ) + property_data["4"] = ZoneTable.query.filter( + ZoneTable.zoneID == property_data.zone_id + ).first().DisplayDescription if property_data["6"] == 0: property_data["6"] = "Private" @@ -272,11 +264,9 @@ def get(status="all"): else: property_data["7"] = '''

''' - property_data["13"] = query_cdclient( - 'select DisplayDescription from ZoneTable where zoneID = ?', - [property_data["13"]], - one=True - ) + property_data["13"] = ZoneTable.query.filter( + ZoneTable.zoneID == property_data.zone_id + ).first().DisplayDescription return data