Compare commits
No commits in common. "6d5f74bd6246e850703b8dc9c94096baff200cae" and "516c2cdf8132e337b2fb7a245a42d7d165ce0d4a" have entirely different histories.
6d5f74bd62
...
516c2cdf81
@ -28,10 +28,10 @@ class Config(object):
|
||||
MAIL_SUPPRESS_SEND = False
|
||||
MAIL_ASCII_ATTACHMENTS = bool(os.getenv('MAIL_ASCII_ATTACHMENTS'))
|
||||
|
||||
class Production(Config):
|
||||
class ProductionConfig(Config):
|
||||
pass
|
||||
|
||||
class Development(Config):
|
||||
class DevelopmentConfig(Config):
|
||||
APP_HOST = '127.0.0.1'
|
||||
DEBUG = True
|
||||
SESSION_COOKIE_SECURE = False
|
||||
@ -39,7 +39,7 @@ class Development(Config):
|
||||
MAIL_DEBUG = True
|
||||
MAIL_SUPPRESS_SEND = False
|
||||
|
||||
class Testing(Development):
|
||||
class TestingConfig(DevelopmentConfig):
|
||||
TESTING = True
|
||||
SESSION_COOKIE_SECURE = False
|
||||
MAIL_SERVER = os.getenv('MAIL_SERVER')
|
||||
|
@ -19,39 +19,6 @@ def validate_json(file):
|
||||
file.stream.seek(0)
|
||||
data = json.loads(file.read())
|
||||
if not isinstance(data, list): return False
|
||||
for block in data:
|
||||
block_type = block.pop('type', None)
|
||||
if block_type not in ['block', 'question']: return False
|
||||
if block_type == 'question':
|
||||
if not all (key in block for key in ['q_no', 'text', 'options', 'correct', 'q_type', 'tags']): return False
|
||||
if not isinstance(block['q_no'], int): return False
|
||||
if not isinstance(block['text'], str): return False
|
||||
if not isinstance(block['options'], list): return False
|
||||
for option in block['options']:
|
||||
if not isinstance(option, str): return False
|
||||
if not isinstance(block['correct'], int): return False
|
||||
if not isinstance(block['q_type'], str): return False
|
||||
if block['q_type'] not in ['Multiple Choice', 'Yes/No', 'List']: return False
|
||||
if not isinstance(block['tags'], list): return False
|
||||
for tag in block['tags']:
|
||||
if not isinstance(tag, str): return False
|
||||
if block_type == 'block':
|
||||
if not all (key in block for key in ['question_header', 'questions']): return False
|
||||
if not isinstance(block['question_header'], str): return False
|
||||
if not isinstance(block['questions'], list): return False
|
||||
for question in block['questions']:
|
||||
if not all (key in question for key in ['q_no', 'text', 'options', 'correct', 'q_type', 'tags']): return False
|
||||
if not isinstance(question['text'], str): return False
|
||||
if not isinstance(question['q_no'], int): return False
|
||||
if not isinstance(question['options'], list): return False
|
||||
for option in question['options']:
|
||||
if not isinstance(option, str): return False
|
||||
if not isinstance(question['correct'], int): return False
|
||||
if not isinstance(question['q_type'], str): return False
|
||||
if question['q_type'] not in ['Multiple Choice', 'Yes/No', 'List']: return False
|
||||
if not isinstance(question['tags'], list): return False
|
||||
for tag in question['tags']:
|
||||
if not isinstance(tag, str): return False
|
||||
return True
|
||||
|
||||
def randomise_list(list:list):
|
||||
|
@ -1 +1 @@
|
||||
from app.config import Production as Config
|
||||
from app.config import ProductionConfig as Config
|
@ -80,4 +80,5 @@ def create_app():
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__': app.run()
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
@ -1,2 +1,4 @@
|
||||
from main import app
|
||||
if __name__ == '__main__': app.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
Loading…
Reference in New Issue
Block a user