简体   繁体   English

在Plone中注销一个zcml资源目录

[英]Unregister a zcml resource directory in Plone

I would like to 'unregister' a resource directory registered with configure zcml and the directive 我想“注销”使用configure zcml和指令注册的资源目录

I have uninstalled my custom add-on that originally registered the resource directory, but other packages are still able to call /++resource++my.package and bring in resources from the uninstalled addon... is there a directive to unregister it properly, or via ZMI or one-off script somehow? 我已经卸载了最初注册资源目录的自定义加载项,但是其他软件包仍然可以调用/++resource++my.package并从已卸载的加载项中引入资源...是否有用于注销它的指令正确,还是通过ZMI或一次性脚本?

Ref: http://plone.org/products/dexterity/documentation/manual/five.grok/browser-components/resource-directories 参考: http : //plone.org/products/dexterity/documentation/manual/five.grok/browser-components/resource-directories

You want to use z3c.unconfigure 您要使用z3c.unconfigure

http://pypi.python.org/pypi/z3c.unconfigure http://pypi.python.org/pypi/z3c.unconfigure

You are confused between install and uninstall of the persistent configurations, through the Plone control panel, and actual removal of the egg from your buildout. 通过Plone控制面板安装和卸载持久性配置,以及从构建物中实际删除鸡蛋之间,您会感到困惑。

Resource directories are registered in the package ZCML files, and are not persistent. 资源目录在软件包ZCML文件中注册,并且不是永久的。 You'll have to remove the package egg from your buildout for these ZCML files to not be loaded. 您必须从构建中删除包鸡蛋,才能不加载这些ZCML文件。

If you, for some reason, need code provided by the package egg but absolutely do not want the resources to be registered, you'll need to use the z3c.unconfigure package to unregister the resource directories again. 如果出于某种原因,您需要鸡蛋包提供的代码,但绝对不希望注册资源,则需要使用z3c.unconfigure软件包再次注销资源目录。

Unless they actively interfere with anything I see no need for you to do so, though. 除非他们积极干预任何事情,但是我认为您没有必要这样做。 Note that there is absolutely no harm in having the resource URLs still available in your Plone site. 请注意,在您的Plone站点中仍然可以使用资源URL绝对没有害处。

Why wouldn't you just remove the unnecessary registration from your package, if you're not using it? 如果您不使用软件包,为什么不从软件包中删除不必要的注册呢?

Another option would be to register the resource directory for a particular browser layer (I believe that's possible in ZCML, anyway) and then only install that layer with your package using browserlayer.xml in GenericSetup. 另一种选择是为特定浏览器层注册资源目录(无论如何,我相信这在ZCML中是可能的),然后仅使用GenericSetup中的browserlayer.xml将该层与您的软件包一起安装。 That's more complex, though. 不过,这更复杂。

As Martijn says, however, there's no harm in leaving it where it is. 但是,正如马丁(Martijn)所说,将其保留在原处没有任何危害。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM