From 1ad328904d71ca5cc9b6470a40d9c4dafbdb2a4c Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 13 Mar 2019 18:35:01 -0300 Subject: [PATCH] admin_schemas: move FEATURES schema to there --- litecord/admin_schemas.py | 11 +++++++++++ litecord/blueprints/admin_api/features.py | 3 ++- litecord/schemas.py | 10 +--------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/litecord/admin_schemas.py b/litecord/admin_schemas.py index 3896dc9..18d0e50 100644 --- a/litecord/admin_schemas.py +++ b/litecord/admin_schemas.py @@ -17,6 +17,8 @@ along with this program. If not, see . """ +from litecord.enums import Feature + VOICE_SERVER = { 'hostname': {'type': 'string', 'maxlength': 255, 'required': True} } @@ -29,3 +31,12 @@ VOICE_REGION = { 'deprecated': {'type': 'boolean', 'default': False}, 'custom': {'type': 'boolean', 'default': False}, } + +FEATURES = { + 'features': { + 'type': 'list', 'required': True, + + # using Feature doesn't seem to work with a "not callable" error. + 'schema': {'coerce': lambda x: Feature(x)} + } +} diff --git a/litecord/blueprints/admin_api/features.py b/litecord/blueprints/admin_api/features.py index 08898a6..81d5099 100644 --- a/litecord/blueprints/admin_api/features.py +++ b/litecord/blueprints/admin_api/features.py @@ -22,7 +22,8 @@ from quart import Blueprint, current_app as app, jsonify, request from litecord.auth import admin_check from litecord.errors import BadRequest -from litecord.schemas import validate, FEATURES +from litecord.schemas import validate +from litecord.admin_schemas import FEATURES from litecord.blueprints.guilds import vanity_invite bp = Blueprint('features_admin', __name__) diff --git a/litecord/schemas.py b/litecord/schemas.py index 9efe7a9..80deca9 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -28,7 +28,7 @@ from .permissions import Permissions from .types import Color from .enums import ( ActivityType, StatusType, ExplicitFilter, RelationshipType, - MessageNotifications, ChannelType, VerificationLevel, Feature + MessageNotifications, ChannelType, VerificationLevel ) from litecord.embed.schemas import EMBED_OBJECT @@ -656,14 +656,6 @@ GET_MENTIONS = { 'guild_id': {'coerce': int, 'required': False} } -FEATURES = { - 'features': { - 'type': 'list', 'required': True, - - # using Feature doesn't seem to work with a "not callable" error. - 'schema': {'coerce': lambda x: Feature(x)} - } -} VANITY_URL_PATCH = { # TODO: put proper values in maybe an invite data type