Discussion:
[Zope3-dev] ZCML-Directive for DirectoryResource factories?
Christian Zagrodnick
2007-09-18 09:30:17 UTC
Permalink
Hoi,

I was just playing with z3c.zrtresource a bit and it seems to be quite
a nice approach to (for instance) set the server URL in javascript.

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?
--
Christian Zagrodnick

gocept gmbh & co. kg ? forsterstrasse 29 ? 06112 halle/saale
www.gocept.com ? fon. +49 345 12298894 ? fax. +49 345 12298891
Fred Drake
2007-10-05 13:30:16 UTC
Permalink
Meant to send this to the list...
Post by Christian Zagrodnick
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
(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
Christian Zagrodnick
2007-10-08 09:09:59 UTC
Permalink
Post by Fred Drake
Meant to send this to the list...
Post by Christian Zagrodnick
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
(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
Loading...