diff --git a/app/main.py b/app/main.py index 3818ea6..d23c272 100644 --- a/app/main.py +++ b/app/main.py @@ -13,7 +13,7 @@ import pickle_idea, pickle_idea2 import os import random, glob from datetime import datetime -from flask import Flask, request, redirect, render_template, url_for, session, abort, flash +from flask import Flask, request, redirect, render_template, url_for, session, abort, flash, get_flashed_messages from difficulty import get_difficulty_level, text_difficulty_level, user_difficulty_level app = Flask(__name__) @@ -192,6 +192,15 @@ def get_answer_part(s): return html_code +def get_flashed_messages_if_any(): + messages = get_flashed_messages() + s = '' + for message in messages: + s += '
English Pal for %s 登出
' % (username) + page += get_flashed_messages_if_any() page += '阅读文章并回答问题
\n' page += '' % (username) page += '