0

I would like to 'unregister' a resource directory registered with configure zcml and the directive

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?

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

3
  • If the ++resource++my.package urls still work, then the ZCML file itself is still being included. In other words, it's impossible for the URLs to still work with the egg not being present, so doublecheck that it was removed properly. Resource directory registrations are not persistent.
    – Martijn Pieters
    Oct 30, 2012 at 8:52
  • yes the egg is still present but the add-on is no longer installed... if the registration is not persistant why are the url's still working after restart? Oct 30, 2012 at 9:26
  • Because the registrations are not stored in the ZODB (persistent), but in package configuration files loaded because the egg is still part of the buildout. I've added an answer.
    – Martijn Pieters
    Oct 30, 2012 at 9:33

3 Answers 3

1

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.

Resource directories are registered in the package ZCML files, and are not persistent. You'll have to remove the package egg from your buildout for these ZCML files to not be loaded.

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.

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.

2
  • Thanks Martijn that makes sense now. What i see here is a little disconnect between the concept of an installed Plone add-on and the underlying framework manipulations possible in an addon that is in the build but not actively installed. Oct 30, 2012 at 22:37
  • 1
    @AaronWilliams: As optilude points out, you could register the resource for a specific browser layer instead, and thus 'toggle' the resource being available by installing and uninstalling the browser layer. Overkill, in my opinion, but the option is there.
    – Martijn Pieters
    Oct 31, 2012 at 8:52
1

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. That's more complex, though.

As Martijn says, however, there's no harm in leaving it where it is.

2
  • Yes you're right optilude but it was bugging me why a package listed as uninstalled in portal_quickinstaller is still having an effect on the site. So aside from resource registry directives, are there any other configurations that apply once included but not yet 'installed' eg how about z3c.jbot overrides? Is there a rule-of-thumb for this? I expect Plone is set up this way as otherwise you would need a restart after installing add-ons to pick up any of these configurations? What do other CMS's do? Thanks for the lesson guys hope it helps others pull back the veil a little as well. Oct 30, 2012 at 23:10
  • 1
    In general, configuration done in ZCML applies regardless of whether an add-on is installed in the quick installer (this is also referred to as "activating" the add-on), but configuration done in a GenericSetup profile performs persistent changes to the database and doesn't occur until the add-on is activated. Oct 31, 2012 at 6:41
0

You want to use z3c.unconfigure

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.