我的 formencode.variabledecode 返回一个空列表 - Pylons
HTML:
<input type="text" name="blah-0" value="test" />
<input type="text" name="blah-1" value="another test" />
控制器:
class myvalidator(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
test = formencode.ForEach(formencode.validators.String())
def form_posted(self):
form_result = myvalidator().to_python(request.params)
print form_result
我想要得到的是返回的列表。比如:
> print form_result['blah']
['test', 'another test']
我做错了什么?
HTML:
<input type="text" name="blah-0" value="test" />
<input type="text" name="blah-1" value="another test" />
Controller:
class myvalidator(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
test = formencode.ForEach(formencode.validators.String())
def form_posted(self):
form_result = myvalidator().to_python(request.params)
print form_result
What I'm trying to get is a list returned. Something like:
> print form_result['blah']
['test', 'another test']
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的示例不完整,但您必须先解码变量:
如果您想要 blah: ,您还应该更改该行
:
Your example is incomplete but you must decode your variables before:
You also should change that line if you want blah:
to: