[Grok-dev] grok.ResourceDirectory docs

Jasper Spaans j at jasper.es
Tue Jun 23 11:49:17 EDT 2009


The current grok universe lacks useful documentation for
grok.DirectoryResource (written by j-w), which is rather helpful when doing
stuff with hurry.resource. Here's a small snippet of code which documents
that for eternity in the list-archives. Here's the sample, I'll put it in
the site tonight.

import grok
from hurry.jquery import jquery
from hurry.resource import Library, ResourceInclusion

class jsdir(grok.DirectoryResource):

localjs = Library('js')

sprintf = ResourceInclusion(localjs, 'jquery.sprintf.js', depends=[jquery])

Now, putting something like sprintf.need() in your views at the right place
will cause the publisher to include the snippets for both jquery and

Jasper Spaans

Fox-IT Experts in IT Security!                                 
I www.fox-it.com

More information about the Grok-dev mailing list