plone 中默认阻止上下文 portlet
我有一个自定义 portlet 管理器,并且我想默认将上下文(也称为父级)portlet 列入黑名单(也称为块)。我找到了几种方法,但它们要么需要特定位置(因此不是站点范围内的),要么只有在与定义 portlet 管理器的包位于不同的包中时才有效(setuphanders.py 在 portlets.xml 之前运行)已导入,因此 portlet 管理器尚不存在),它不是运行程序。
我真正想做的是在 portlets.xml 中使用 genericSetup 黑名单语法,并在位置处使用“*”,如下所示:
<blacklist
manager="custom.portletmanager"
location="*"
category="context"
status="block"
/>
但是,唉,这似乎不起作用。有什么建议吗?
I have a custom portlet manager, and I'd like to blacklist (aka block) context (aka parent) portlets by default. I've found a couple of methods but they either require a specific location (so not sitewide) or will only work if I'm in a different package to where the portlet manager is defined (setuphanders.py is run before portlets.xml is imported and therefore the portlet manager doesn't exist yet), which is not a runner.
What I'd really like to do is use the genericSetup blacklist syntax in portlets.xml with a '*' for the location like this:
<blacklist
manager="custom.portletmanager"
location="*"
category="context"
status="block"
/>
But, alas, that doesn't seem to work. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以覆盖 portlet 上的某些权限(可能在 overrides.zcml 中),但需要一个不存在的权限?
或者,有一个
z3c.unconfigure
包可以完全取消注册 portlet。Perhaps you can override some permission on the portlet (possibly in overrides.zcml), requiring a non-existing permission?
Alternatively, there's a
z3c.unconfigure
package that may be able to unregister the portlet entirely.也许迟到总比不到好:在 PortletManager 的 __init __ 中使用它将继承的默认值设置为 false,但您仍然可以覆盖它 TTW。 (这种方法不会扩展到其他两个事物,它们已经具有“块/显示/继承”的三元语义,因此我们无法区分默认值和用户设置值,并且每次都会调用 __init __ .)
Better late than never, maybe: using this in your PortletManager's __init _ _ sets the default for inheriting to false, but you can still override it TTW. (This approach does not extend to the other two things, which have a ternary semantic of "block/show/inherit" already, so we can't distinguish a default value from a user-set value and __init _ _ is called every time.)