Create symbolic (file system) links to all ++resource++ resources

I'd like to have a recipe to collect all registered resources from all packages (provided by ${instance:eggs}) and create symbolic links in my (Apache-speak) DocumentRoot.

Why?

  • I'd like to have those resources served directly by the front http server (unless part of a compiled collection, which is nothing I intend to touch); I could exclude all requests to ^/++resource++* paths from the RewriteRule and thus unburden the Python threads.
  • During development, every change to the symlinked resources would be effective immediately when requested again.

I found out about the concept of zope.traversing.browser.interfaces.IAbsoluteURL, but this is not what I need:

  • I know already the kind of URL I like to use (the resource namespace);
  • I don't intend to use another server to provide me with resources;
  • instead, I want to use the resources as configured via ZCML in my installed packages.

My question is: Is there some official way to query the registered resources?
Or would I need to traverse all packages myself (e.g. the way collective.recipe.omelette does it), and parse the configure.zcml files myself for <browser:resource> and <browser:resourceDirectory> entries?

My so-far efforts are public already, see https://pypi.org/project/visaplan.recipe.symlinks and https://github.com/visaplan/visaplan.recipe.symlinks.

Help and/or comments are appreciated.

Plone Foundation Code of Conduct