diff --git a/app/main.py b/app/main.py index 3818ea6..024bac9 100644 --- a/app/main.py +++ b/app/main.py @@ -192,6 +192,15 @@ def get_answer_part(s): return html_code +def get_flashed_messages_if_any(): + messages = get_flashed_messages() + if messages == []: + return '' + s = '' + @app.route("//reset", methods=['GET', 'POST']) def user_reset(username): @@ -317,6 +326,7 @@ def familiar(username,word): def deleteword(username,word): user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) pickle_idea2.deleteRecord(user_freq_record,word) + flash(f'Congratulations! {word} is no longer in your word list.') return redirect(url_for('userpage', username=username)) @app.route("/", methods=['GET', 'POST']) @@ -359,6 +369,7 @@ def userpage(username): page += 'EnglishPal Study Room for %s' % (username) page += '
' page += '

English Pal for %s 登出

' % (username) + page += get_flashed_messages_if_any() page += '

阅读文章并回答问题

\n' page += '

下一篇 Next Article

' % (username) page += '
%s
' % (get_today_article(user_freq_record, session['articleID']))