Zope 2 编码/解码 request.form.items 的位置
Plone 3.3.x
在一台服务器上, self.request.post.values() 是 unicode (正确)。 在另一台服务器上,它们是字节串。
到底是怎么回事?
Zope怪物的深处哪里决定了这一点?为什么它们不同?为什么我不到30岁头发就全掉光了?
Plone 3.3.x
On one server, self.request.post.values() are unicode (correct).
On another server, they are bytestrings.
What is going on?
Where in the depth of Zope monster this is decided? Why they are different? Why I am loosing all hair before I have turned 30?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,Zope 2 会对请求值进行编码。但是一些表单库(formlib、z3c.form)是为 Zope 3 编写的并且想要处理 Unicode,因此在 Five(processInputs)中有一个帮助程序,它们在执行任何其他操作之前调用它来解码请求
plone.z3cform 通过以下方式执行此操作对基本表单类的 update 方法进行猴子修补以调用 processInputs。出于某种原因,听起来您的情况似乎没有被调用。
By default Zope 2 leaves the request values encoded. But some form libraries (formlib, z3c.form) were written for Zope 3 and want to deal with Unicode, so there is a helper in Five (processInputs) which they call to decode the request before doing anything else
plone.z3cform does this by monkey-patching the base form class's update method to call processInputs. It sounds like that is not getting called in your case, for some reason.