微信服务器需要接收Plone服务器的xml文档响应。但是我不知道如何将xml文档返回给请求客户端。(微信服务器)谢谢。
发布于 2014-11-17 15:03:48
创建一个BrowserView,它返回xml,并为响应设置正确的头部。
向zcml注册BrowserView:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<browser:page
for="*"
permission="zope2.View"
class=".views.MyViewReturningXML"
name="my_view.xml"
/>
</configure>
对应的python代码:
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class MyViewReturningXML(BrowserView):
template = ViewPageTemplateFile("my_template.xml")
def __call__(self):
# Set header
self.request.RESPONSE.setHeader("Content-type", "text/xml")
return self.template()
#...
#IMPLEMENTATION
#....
https://stackoverflow.com/questions/26964117
复制相似问题