[Zope3-dev] Re: ZCML-Directive for DirectoryResource factories?
Christian Zagrodnick
cz at gocept.com
Mon Oct 8 04:09:21 EDT 2007
On 2007-10-05 14:30:14 +0200, "Fred Drake" <fdrake at gmail.com> said:
> Meant to send this to the list...
>
> On 9/18/07, Christian Zagrodnick <cz at gocept.com> 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.
You are right, a local map would be much better.
I basically came up with the global one, because its already there. But
local sounds good.
--
Christian Zagrodnick
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
More information about the Zope3-dev
mailing list