forked from mrlan/EnglishPal
1. 取消userpage_get.html中提示删除单词信息的代码 和 取消user_service.userpage中render_template的flashed_messages参数。因为删除单词操作已经是异步了,而提示信息的出现是同步执行,所以就注释了代码且没有产生太大影响。
2. 修改取消user_service.deleteword中对注释flash代码的注释,根据上一步进行了重新解释。
parent
c9bfa08658
commit
5b2f5199a8
|
@ -40,9 +40,9 @@
|
||||||
<a class="btn btn-secondary" href="/logout" role="button">退出</a>
|
<a class="btn btn-secondary" href="/logout" role="button">退出</a>
|
||||||
<a class="btn btn-secondary" href="/reset" role="button">重设密码</a>
|
<a class="btn btn-secondary" href="/reset" role="button">重设密码</a>
|
||||||
</p>
|
</p>
|
||||||
{% for message in messages %}
|
{# {% for message in flashed_messages %}#} {# 根据user_service.userpage,取消了参数flashed_messages,因此注释了这段代码 #}
|
||||||
<div class="alert alert-warning" role="alert">Congratulations! {{ message }}</div>
|
{# <div class="alert alert-warning" role="alert">Congratulations! {{ message }}</div>#}
|
||||||
{% endfor %}
|
{# {% endfor %}#}
|
||||||
|
|
||||||
<a class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a>
|
<a class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a>
|
||||||
{% if session.get('existing_articles')[0] != None and session.get('existing_articles')[0] !=0 %}
|
{% if session.get('existing_articles')[0] != None and session.get('existing_articles')[0] !=0 %}
|
||||||
|
|
|
@ -92,8 +92,8 @@ def deleteword(username, word):
|
||||||
'''
|
'''
|
||||||
user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username)
|
user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username)
|
||||||
pickle_idea2.deleteRecord(user_freq_record, word)
|
pickle_idea2.deleteRecord(user_freq_record, word)
|
||||||
# 模板 userpage_get.html 中已经没有对flash信息的获取了,而且会影响 signup.html的显示,因为其中去获取了flash。在删除单词,退出,注册,页面就会出现提示信息
|
# 模板userpage_get.html中删除单词是异步执行,而flash的信息后续是同步执行的,所以注释这段代码;同时如果这里使用flash但不提取信息,则会影响 signup.html的显示。bug复现:删除单词后,点击退出,点击注册,注册页面就会出现提示信息
|
||||||
# flash(f'<strong>{word}</strong> is no longer in your word list.')
|
# flash(f'{word} is no longer in your word list.')
|
||||||
return "success"
|
return "success"
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ def userpage(username):
|
||||||
return render_template('userpage_get.html',
|
return render_template('userpage_get.html',
|
||||||
username=username,
|
username=username,
|
||||||
session=session,
|
session=session,
|
||||||
flashed_messages=get_flashed_messages(),
|
# flashed_messages=get_flashed_messages(), 仅有删除单词的时候使用到flash,而删除单词是异步执行,这里的信息提示是同步执行,所以就没有存在的必要了
|
||||||
today_article=today_article,
|
today_article=today_article,
|
||||||
d_len=len(d),
|
d_len=len(d),
|
||||||
lst3=lst3,
|
lst3=lst3,
|
||||||
|
|
Loading…
Reference in New Issue