开发者

WTForms error:TypeError: formdata should be a multidict-type wrapper

from wtforms import Form, BooleanField, TextField, validators,PasswordField
class LoginForm(Form):
    username     = TextField('Username', [validators.Length(min=4, max=25)])
    password = PasswordField('Password')

when i use LoginForm on webapp(gae) like this :

def post(self):
    form=LoginForm(self.request)

but it show error :

Traceback (most recent call last):
  File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 513, in __call__
    handler.post(*groups)
  File "D:\zjm_code\forum_blog_gae\main.py", line 189, in post
    form=LoginForm(self.request)
  File "D:\zjm_code\forum_blog_gae\wtforms\form.py", line 161, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "D:\zjm_code\forum_blog_gae\wtforms\form.py", line 214, in __init__
    self.process(formdata, obj, **kwargs)
  File "D:\zjm_code\forum_blog_gae\wtforms\form.py", line 85, in process
    raise TypeError("formdata should be a multidict-type wrapper that supports the 'getlist' method开发者_如何转开发")
TypeError: formdata should be a multidict-type wrapper that supports the 'getlist' method

how to make it running

thanks


You are supposed to pass in self.request.form (the actual form fields, not the entire request)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜