[Grok-dev] Extending Grok with Custom Grokkers
faassen at startifact.com
Fri Dec 5 17:21:44 EST 2008
Paul Wilson wrote:
> I am interested in extending grok with custom grokkers for my
> application's purposes. My intention is to later allow developers to
> extend my application with their own classes and I'd like to package
> this functionality separately. I've been looking at megrok.* for
> inspiration and think I need to include a meta.zcml (along with the
> usual martian modules). So, am I correct in thinking that Grok uses
> meta.zcml to register it's grokkers? Is there any documentation on how
> this works or how to accomplish this?
You could also look at the grokcore.* packages for inspiration. I think
grokcore.component's structure is nice enough (of course you wouldn't
need to register the grok ZCML directive as it does in its meta.zcml).
Anyway, yes, we use meta.zcml to register the grokkers. meta.zcml will
get loaded before the main configure.zcml (which contains the grok
directive) so that the grokkers will be in place in time. If you use
includeDependencies from z3c.autoinclude (which standard
grokproject-created projects do), it'll include the meta.zcml first
automatically when the dependency is listed in setup.py.
There isn't any documentation yet as far as I know (check
grok.zope.org?), but we'd love contributions!
More information about the Grok-dev