[Grok-dev] grokcore.resource
Jan-Jaap Driessen
janjaapdriessen at gmail.com
Mon May 14 19:02:27 UTC 2012
After the recent grok sprint I have spent some hours taking parts of
megrok.resource and putting them in the grokcore.resource package:
svn+ssh://svn.zope.org/repos/main/grokcore.resource/trunk
grokcore.resource helps you use fanstatic resources in your view
components. Instead of `needing` resources in the update method of
your view components, you can use a directive to associate resources
with a view component, so instead of::
class MyView(grok.View):
def update(self):
myresource.need()
You write::
class MyView(grok.View):
grok.resources(myresource)
This removes a lot of one-line update methods from our code base,
which is good. grokcore.resource works for grok.View, grok.Viewlet,
grok.Layout and grok.ContentProvider view components.
Are you ok with making this a part of grok? I created a branch of grok
in which I incorporated grokcore.resource:
svn+ssh://svn.zope.org/repos/main/grok/branches/janjaapdriessen-grokcore-resource
I would like you to try this out in your own applications. Let me know
if you have any questions.
JJ
More information about the Grok-dev
mailing list