[Grok-dev] Re: checked in: megrok.resourcelibrary
Martijn Faassen
faassen at startifact.com
Thu Aug 7 09:35:50 EDT 2008
Hey,
Wichert Akkerman wrote:
[snip]
> There are basically two things that you need: a way to construct a URL
> to a resource and a way to conveniently serve those resources.
> resourcelibrary does both, but I am advocating that it should be
> possible to split them up. I want to be able to say 'my resources are at
> http://static.mysite.com' and use apache to serve them without having
> to rewrite all my templates.
Sure, I agree that's a desirable feature.
Having an explicit concept of a resource library should be of use there.
I don't think Zope 3's resource infrastructure supplies for this
directly, but it should be possible to supply the system with an
alternative factory for DirectoryResource that knows about publishing
them using Apache. Resource objects are in control of creating URLs.
megrok.resourcelibrary doesn't supply for this directly yet. Alternative
factory support should be easy enough to add, but it'd be nice if there
were some higher level ability to make URLs go somewhere else. Note also
that in order to actually know which resources there are (if only to
generate URLs), the resource library *still* needs access to the files
in question, no matter how they are published.
If one does this, it would of course be interesting to be able to
specify where the real resource URLs are during deployment, perhaps in
zope.conf (which can be generated by buildout.cfg).
People are welcome to try adding in this support. The custom factory
support is already in zc.resourcelibrary, though I left it out of
megrok.resourcelibrary for now. It should be very easy to add it back.
Then it'd be a matter of creating a factory that takes looks for its
configuration information in zope.conf, looking for a section based on
the name of the resource library.
Regards,
Martijn
More information about the Grok-dev
mailing list