[Grok-dev] grok.ResourceDirectory docs

Souheil CHELFOUH trollfot at gmail.com
Wed Jun 24 06:21:05 EDT 2009


Just my 2 cents, but, if you have to register several libraries, isn't this
a bit too verbose ?
Can't we have something grokking it all in one shot, like
megrok.resourcelibrary ?


2009/6/23 Jasper Spaans <j at jasper.es>

> Hi,
>
> 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):
>    grok.name('js')
>    grok.path('js')
>
> 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
> jquery.sprintf
>
> Cheers,
> --
> Jasper Spaans
>
> Fox-IT Experts in IT Security!
> I www.fox-it.com
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090624/d23bc961/attachment.html 


More information about the Grok-dev mailing list