我在服务器上工作并使用烧瓶作为网络框架,我遇到了这个错误。TypeError: Challenge() 只需要 3 个参数(给定 1 个),即使我向 Challenge 发送了 3 个参数
以下是代码:
def login_required(test):
@wraps(test)
def wrap(*args, **kwargs):
if 'Logged_In' in session:
return test(*args, **kwargs)
else:
flash('You need to login first.')
return redirect(url_for('login'))
return wrap
if request.method == 'POST':
if request.form['button'] == 'Challenge':
game = session['User'] + ',' + profUser + ',' + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return redirect(url_for('Challenge', game=game, white=session['User'], black=profUser))
@app.route('/<game>')
@login_required
def Challenge(game, white, black):
if session['User'] == white:
side = "white"
if session['User'] == black:
side = "black"
else:
side = None
return render_template('game.html', game=game, user=session['User'], side=side)