Zope2 XML-RPC 和 AT Image mutator 之间的交互不良?
我正在为 mr.migrator 创建一个 演示,但遇到了一个恼人的问题,此处展示:
# create image
proxy = xmlrpclib.ServerProxy(url) # reset
data = open('screenshot.png').read()
try:
proxy.invokeFactory('Image', 'screenshot.png')
except xmlrpclib.ProtocolError:
print sys.exc_info()[1]
except xmlrpclib.Fault:
print "The id is invalid - it is already in use." # most likely
proxy = xmlrpclib.ServerProxy(url + '/screenshot.png')
proxy.setTitle('This is an image')
try:
proxy.setImage(data) # XXX this fails
except:
print sys.exc_info()[1]
此代码应使用图像中的数据填充图像字段,但相反失败始终是:
<ProtocolError for admin:admin@localhost:8080/Plone/screenshot.png: 500 Internal Server Error>
更糟糕的是,这就是 Zope2 所说的全部。在前台运行 Plone 时,我没有看到任何回溯或任何其他表明出现问题的信息。
我的下一步是什么?您可以在此处查看并重现此内容:
我会做这是“正常”方式,将关键字参数传递给 invokeFactory,但是 XML-RPC 不支持它们。
I am creating a demo for mr.migrator and have run in to an annoying problem, showcased here:
# create image
proxy = xmlrpclib.ServerProxy(url) # reset
data = open('screenshot.png').read()
try:
proxy.invokeFactory('Image', 'screenshot.png')
except xmlrpclib.ProtocolError:
print sys.exc_info()[1]
except xmlrpclib.Fault:
print "The id is invalid - it is already in use." # most likely
proxy = xmlrpclib.ServerProxy(url + '/screenshot.png')
proxy.setTitle('This is an image')
try:
proxy.setImage(data) # XXX this fails
except:
print sys.exc_info()[1]
This code should populate the image field with data from the image, but instead it fails consistently with:
<ProtocolError for admin:admin@localhost:8080/Plone/screenshot.png: 500 Internal Server Error>
Worse, this is all Zope2 says. I don't see any tracebacks or anything else that indicates a problem when running Plone in the foreground.
What's my next step? You can check out and reproduce this here:
I would do this the "normal" way, with keyword arguments passed to invokeFactory, but XML-RPC does not support them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很可能是特殊字符错误。 xml-rpc 协议可以使用 XML 允许您使用的任何字符。您应该尝试将图像数据包装在二进制包装器中:
更多信息:
This is most likely a special character error. The xml-rpc protocol can use any character XML allows you to use. You should try to wrap the image data in a Binary wrapper:
More info: