diff --git a/app/static/.DS_Store b/app/static/.DS_Store new file mode 100644 index 0000000..0c9d7b0 Binary files /dev/null and b/app/static/.DS_Store differ diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 4cc6835..6211cd1 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -55,9 +55,9 @@ 重设密码

-{# {% for message in flashed_messages %}#} {# 根据user_service.userpage,取消了参数flashed_messages,因此注释了这段代码 #} -{# #} -{# {% endfor %}#} + {% for message in get_flashed_messages() %} + + {% endfor %} diff --git a/app/user_service.py b/app/user_service.py index 6c208dc..27323b8 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -181,7 +181,11 @@ def user_mark_word(username): for word in request.form.getlist('marked'): lst.append((word, [get_time()])) d = pickle_idea2.merge_frequency(lst, lst_history) - pickle_idea2.save_frequency_to_pickle(d, user_freq_record) + if len(lst_history) > 999: + flash('You have way too many words in your difficult-words book. Delete some first.') + else: + pickle_idea2.save_frequency_to_pickle(d, user_freq_record) + flash('Added %s.' % (', '.join(request.form.getlist('marked')))) return redirect(url_for('user_bp.userpage', username=username)) else: return 'Under construction'