gpt4 book ai didi

plone - 防止某些类型出现在 plone.app.theming 的文件夹列表中

转载 作者:行者123 更新时间:2023-12-02 04:01:18 25 4
gpt4 key购买 nike

我有一个网站,它有一个通过 plone.app.theming/Diazo 主题显示的公共(public) url,并且 url 仅限于通过 sunburst 显示的内容编辑器。

我希望某些门户类型只出现在 cms 编辑器的列表中,而不出现在公共(public)站点上。我注意到 folder_listing 模板使用 request/contentFilter如果定义。有没有办法为主题 View 的请求添加内容过滤器?

最佳答案

我最终使用 Plone 站点上的预遍历钩子(Hook)解决了这个问题。这对我来说很有效,因为我可以根据请求的某些属性可靠地确定请求是针对主题 View 还是针对编辑 View 。

def SetupThemeView(site, before_traverse):
""" If we're serving the public, themed, version then supplement the request
"""
request = before_traverse.request
if serving_theme_view(request):
request.set('contentFilter', {'portal_type' : listable_types})

在哪里 serving_theme_view确定我们是否提供主题或编辑器 View 和 listable_types是我们希望出现在主题 View 列表中的类型名称的元组。

然后我在我的 configure.zcml 中将其注册为订阅者

<subscriber
for="Products.CMFCore.interfaces.ISiteRoot
zope.traversing.interfaces.IBeforeTraverseEvent"
handler=".events.SetupThemeView"
/>

关于plone - 防止某些类型出现在 plone.app.theming 的文件夹列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10427220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com