Re: ZCML-Directive for DirectoryResource factories?

Christian Zagrodnick <[email protected]> Mon, 8 Oct 2007 10:09:21 +0200
Newsgroups gmane.comp.web.zope.zope3
Message-ID <[email protected]>
On 2007-10-05 14:30:14 +0200, "Fred Drake" <[email protected]> said:

> Meant to send this to the list...
>=20
> 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.
>>=20
>> The follwoing makes it possible, but it's not too nice to have that
>> somewhere in the code:
>>=20
>> (zope.app.publisher.browser.directoryresource.
>> DirectoryResource.resource_factories['.js']) =3D (
>> z3c.zrtresource.zrtresource.ZRTFileResourceFactory)
>>=20
>> I'd rather have a ZCML-directive to do that. Would that fit into
>> zope.app.publisher?
>=20
> 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.
>=20
> 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=20
local sounds good.

--=20
Christian Zagrodnick

gocept gmbh & co. kg  =B7  forsterstrasse 29 =B7 06112 halle/saale
www.gocept.com =B7 fon. +49 345 12298894 =B7 fax. +49 345 12298891