def notify(): if request.method == "GET": new = current_user.extract_unread_notify() old = current_user.extract_read_notify() # Mark all the unread notify as read(here we consume the notify is read once open this link). if current_user.unread_notify: if current_user.read_notify: current_user.read_notify = "%s,%s" % (current_user.unread_notify, current_user.read_notify) else: current_user.read_notify = current_user.unread_notify current_user.unread_notify = "" db.session.commit() return render_template('user/notify.html', title=gettext('Notify'), old=old, new=new) else: abort(404)