[Grok-dev] Re: checked in: megrok.resourcelibrary

Martijn Faassen faassen at startifact.com
Wed Aug 6 18:22:14 EDT 2008


Wichert Akkerman wrote:
> Previously Martijn Faassen wrote:
>> Hi there,
>>
>> I just checked in a package called megrok.resourcelibrary. It wraps 
>> zc.resourcelibrary and all the real functionality is in that library, 
>> this just grokifies it. In essence megrok.resourcelibrary lets you set 
>> up your own new 'static' directories.
>>
>> What you can do with this is the following:
>>
>> import megrok.resourcelibrary
>>
>> class MyResources(megrok.resourcelibrary.ResourceLibrary):
>>     megrok.resourcelibrary.directory('some_directory')
>  
> Isn't this something that could be setup using config.ini or a wsgi
> middleware layer? It feels like using python to configure a deployment.

I don't think so. A package may want to ship with resources. Imagine a 
widget that needs a javascript file present. Or a package that 
implements a layout that needs some images. Or a package that has some 
kss files that expect to work together with Python code.

These resources are often intimately related with the code in the Python 
package. It's also nice to be able to construct a virtual-host aware URL 
for them.

Anyway, this is not new - 'static' in Grok works this way, and Zope 2 
has been exposing resources for a long time as well.

Regards,

Martijn



More information about the Grok-dev mailing list