我的验证器似乎有错误。即使我-1
在表单中输入,我仍然会返回我的值而不是blaat
. 也许有人看到我的错误?
class test:
def __init__(self):
self.render = web.template.render('templates/')
self.myForm = web.form.Form(
web.form.Textbox('minutes', id='minutes'),
validators = [form.Validator("Minutes not correct",
lambda i: i.minutes > 0)]
)
def GET(self):
return self.render.addLog(self.myForm)
def POST(self):
webinput = web.input()
if self.myForm.validates():
return webinput.date1+webinput.minutes
else:
return "blaat"