From 5b2f5199a82be7cdb7bb3ac57f7b54b5ea0f4034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E9=97=AE=E4=B8=89=E4=B8=8D=E7=9F=A5?= <178428409@qq.com> Date: Mon, 27 Mar 2023 14:28:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=8F=96=E6=B6=88userpage=5Fget.html?= =?UTF-8?q?=E4=B8=AD=E6=8F=90=E7=A4=BA=E5=88=A0=E9=99=A4=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E4=BB=A3=E7=A0=81=20=E5=92=8C=20?= =?UTF-8?q?=E5=8F=96=E6=B6=88user=5Fservice.userpage=E4=B8=ADrender=5Ftemp?= =?UTF-8?q?late=E7=9A=84flashed=5Fmessages=E5=8F=82=E6=95=B0=E3=80=82?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=88=A0=E9=99=A4=E5=8D=95=E8=AF=8D=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=B7=B2=E7=BB=8F=E6=98=AF=E5=BC=82=E6=AD=A5=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=98=AF=E5=90=8C=E6=AD=A5=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E4=BB=A5=E5=B0=B1=E6=B3=A8=E9=87=8A=E4=BA=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=94=E6=B2=A1=E6=9C=89=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E5=A4=AA=E5=A4=A7=E5=BD=B1=E5=93=8D=E3=80=82=202.=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8F=96=E6=B6=88user=5Fservice.deleteword=E4=B8=AD?= =?UTF-8?q?=E5=AF=B9=E6=B3=A8=E9=87=8Aflash=E4=BB=A3=E7=A0=81=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=EF=BC=8C=E6=A0=B9=E6=8D=AE=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E8=BF=9B=E8=A1=8C=E4=BA=86=E9=87=8D=E6=96=B0=E8=A7=A3?= =?UTF-8?q?=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 6 +++--- app/user_service.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 5ef86c7..c9a04c1 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -40,9 +40,9 @@ 退出 重设密码

- {% for message in messages %} - - {% endfor %} +{# {% for message in flashed_messages %}#} {# 根据user_service.userpage,取消了参数flashed_messages,因此注释了这段代码 #} +{# #} +{# {% endfor %}#} 下一篇 Next Article {% if session.get('existing_articles')[0] != None and session.get('existing_articles')[0] !=0 %} diff --git a/app/user_service.py b/app/user_service.py index 94a522a..1b47d74 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -92,8 +92,8 @@ def deleteword(username, word): ''' user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) pickle_idea2.deleteRecord(user_freq_record, word) - # 模板 userpage_get.html 中已经没有对flash信息的获取了,而且会影响 signup.html的显示,因为其中去获取了flash。在删除单词,退出,注册,页面就会出现提示信息 - # flash(f'{word} is no longer in your word list.') + # 模板userpage_get.html中删除单词是异步执行,而flash的信息后续是同步执行的,所以注释这段代码;同时如果这里使用flash但不提取信息,则会影响 signup.html的显示。bug复现:删除单词后,点击退出,点击注册,注册页面就会出现提示信息 + # flash(f'{word} is no longer in your word list.') return "success" @@ -140,7 +140,7 @@ def userpage(username): return render_template('userpage_get.html', username=username, session=session, - flashed_messages=get_flashed_messages(), + # flashed_messages=get_flashed_messages(), 仅有删除单词的时候使用到flash,而删除单词是异步执行,这里的信息提示是同步执行,所以就没有存在的必要了 today_article=today_article, d_len=len(d), lst3=lst3,