[Zope-dev] Directory resource factories

Jim Fulton jim at zope.com
Sun Feb 24 09:36:11 EST 2008


On Feb 23, 2008, at 10:53 PM, Malthe Borch wrote:

> The z3c.pt-package now provides a template class for plain text  
> files like .css and .js---using the ${<python expression>}-syntax.
>
> I'd like to integrate it with browser resources such that
>
>  filename.css.<some extension for z3c.pt text templates>
>
> would be sent through the template engine.
>
> Now, the DirectoryResource-class defined in  
> zope.app.publisher.browser.directoryresource provides a dictionary  
> of resource factories for a number of standard file extensions.
>
> Shouldn't this be pluggable using the component architecture? It  
> would adapt to IResourceFactory.


+1. Some more details would need to be worked out.  For example, to  
work for your use case, it would need to be involved in search, or the  
searching rules would need to be made more powerful, so, when looking  
for some file name, it is prepared to consider files that have the  
file name as a base and use some additional extension, as in your  
example.  I would love to see someone work this out. A proposal would  
be appreciated.

I recently added a hack^H^H^H^Henhancement to zc.resourcelibrary to  
let you specify a custom directory resource factory to work around  
this limitation so I could have a dynamically generated js file.

Jim

--
Jim Fulton
Zope Corporation




More information about the Zope-Dev mailing list