ZCML-Directive for DirectoryResource factories?
"Fred Drake" <[email protected]> Fri, 5 Oct 2007 08:30:14 -0400
| Newsgroups | gmane.comp.web.zope.zope3 |
|---|---|
| Message-ID | <[email protected]> |
Meant to send this to the list... On 9/18/07, Christian Zagrodnick <[email protected]> wrote: > The only thing is, no I'm not going to register every file in ZCML. I > want to use the zc.resourcelibrary. > > The follwoing makes it possible, but it's not too nice to have that > somewhere in the code: > > (zope.app.publisher.browser.directoryresource. > DirectoryResource.resource_factories['.js']) = ( > z3c.zrtresource.zrtresource.ZRTFileResourceFactory) > > I'd rather have a ZCML-directive to do that. Would that fit into > zope.app.publisher? I think the right approach would be to make the new directive a sub-directive of the resourcelibrary and/or the resourcedirectory directive. Then there could be a separate extension -> type map for each directory of resources. An alternative would be to allow the library or directory directive to refer to a map defined elsewhere (say, in Python), making it easier to re-use maps. This makes a lot of sense to me, since the provider of each pile of resources knows what they put in it and what the processing requirements are. A global map seems like a bad idea here. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller