Plone有一个不错的技巧,可以消除Zope2随附的无聊的 Zope快速入门页面。它改变了这一点:
变成这个:
相关代码位于Products/CMFPlone/browser/admin.zcml
(https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/browser/admin.zcml#L35)中:
<browser:page
for="OFS.interfaces.IApplication"
name="plone-overview"
class=".admin.Overview"
permission="zope.Public"
template="templates/plone-overview.pt"
/>
这就解释了为什么
http://localhost:8080/plone-overview
呈现了plone-overview模板,但是为什么/如何使应用程序根目录(即http://localhost:8080
)呈现了相同的模板? 最佳答案
相同的ZCML文件注册了一个 AppTraverser
adapter;该适配器使OFS.interfaces.IApplication
对象适应IRequest
以拦截遍历。
在IRequest
适配器publishTraverse()
方法中,遍历index_html
名称时,适配器将返回相同的plone-overview
视图:
def publishTraverse(self, request, name):
if name == 'index_html':
view = queryMultiAdapter((self.context, request),
Interface, 'plone-overview')
if view is not None:
return view
return DefaultPublishTraverse.publishTraverse(self, request, name)
参见
AppTraverser
class definition。关于plone - 在Zope2应用程序根目录(在Plone中)如何渲染plone-overview.pt模板?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16781786/