在 pylon 中使用装饰器 (formencode) 时传递状态

发布于 2024-09-18 06:25:11 字数 560 浏览 3 评论 0原文

我遇到了与此页面相同的问题:

http:// /www.mail-archive.com/[电子邮件受保护]/msg14292.html

这是主要内容来自那里:

我正在使用 formencode 来验证我的 表格,我偶然发现了一个 问题。使用验证器时 在控制器操作内部,我调用 to_python() 我可以传递状态 包含我需要的任何信息的变量 给验证者。是否可以 对验证做同样的事情 装饰器?

从那里的答案来看,他们说它还没有固定在塔架上,但那是几个月前的事了。我想知道现在有什么解决办法吗?

I've met the same problem as this page:

http://www.mail-archive.com/[email protected]/msg14292.html

This is the main content from there:

I am using formencode to validate my
forms, and I've stumbled upon a
problem. When using tha validator
inside the controller action, I call
to_python() and I can pass the state
variable with any information I need
to the validators. Is it possible to
do the same with the validate
decorator?

From the answers of there, they said it has not been fixed in pylons, but that was several months agao. I wanna if there any solutions for it now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伤痕我心 2024-09-25 06:25:11
pylons.decorators.validate(schema=None, validators=None, form=None, variable_decode=False, dict_char='.', list_char='-', post_only=True, state=None, on_get=False, **htmlfill_kwargs)

请注意 state 参数。完整文档此处 (Pylons 1.0)

pylons.decorators.validate(schema=None, validators=None, form=None, variable_decode=False, dict_char='.', list_char='-', post_only=True, state=None, on_get=False, **htmlfill_kwargs)

Note the state parameter. Full docs here (Pylons 1.0)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文