我有以下看法:
@app.route('/write-blog-post', methods=['POST', 'GET'])
@app.route('/<userID>/write-blog-post', methods=['POST', 'GET'])
def writePost(userID=None):
if not current_user.is_anonymous() and userID != None:
if current_user.id == int(userID):
...
...
由于某些原因,当用户使用Flask登录登录时,因此if not current_user.is_anonymous()
是{
我在其他视图上使用current_user.id
,它成功地工作了。我认为唯一可能导致错误的是视图的多个url可能会干扰某些内容。在
奇怪的是,即使用户同时传递了这两个if语句,函数仍然照常继续。在
有什么问题吗?谢谢。在
目前没有回答
相关问题 更多 >
编程相关推荐