我使用 Bottle 框架制作了一个简单的程序。我收到此错误:
'TypeError: login_submit() 只需要 1 个参数(给定 0)'
代码是:
# -*- coding: cp1252 -*-
import codecs
from bottle import route, run, template
@route('/login')
def login_form():
return '''<form method="POST" action="/login">
<input name="name" type="text" />
<input name="password" type="password" />
<input type="submit" />
</form>'''
@route('/login', method='POST')
def login_submit(request):
name = request.forms.get('name')
password = request.forms.get('password')
if check_login(name, password):
return "<p>Your login was correct</p>"
else:
return "<p>Login failed</p>"
run(host='localhost', port=8080)