[Grok-dev] static versus Zope 3's directory resources

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Nov 19 07:40:48 EST 2007


Grok has built-in support for a resourcedirectory-like feature with the 
"static" subdirectories.

There's a couple of problems with it though:

   * The resources in the static directory are "published" in the 
IBrowserDefault layer, and cannot be published in another layer.

   * Templates in one package might want to use macros defined in 
another package. If the macro refers to resources in the static 
directory, the lookup fails.

Both cases are by no means disasters if you ask me, and I think we 
should continue to support the static directory for the "simple" situations.

For more complex setups however, I think it might be worthwhile to have 
Grok support for Zope 3's (directory)resources. This would then play 
nice with other resource related libraries "out there" like 

I can imagine something like:

   import grok

   class FooResources(grok.DirectoryResources):
       grok.name('foo') # optional, has some sensible default
       grok.layer('my_apps_layer') # optional, like with grok.View
       grok.directory('foo_resources') # optional, has some sensible
                                       # default

What do others think?

kind reagrds,

More information about the Grok-dev mailing list