[Grok-dev] Re: Using martian to load schemata
Martin Aspeli
optilude at gmx.net
Wed Jun 25 12:45:17 EDT 2008
> Yes, you'd have a component called Schema that you'd grok for with a
> ClassGrokker, and you'd define a directive called model. Something like:
>
> class SchemaGrokker(martian.ClassGrokker):
> martian.component(Schema)
> martian.directive(model)
>
> def execute(self, class_, config, model, **kw):
> ... register your action here...
>
> You'd need to use at least grokcore.component to get the 'grok'
> directive available. Martian itself doesn't interface with
> zope.configuration.
I'm happy to depend on grokcore.component. In fact, I may start using it
for other config, and this would be a nice way to sneak it into use with
Plone. :)
> No, that's unrelated. The 'config' parameter comes from the
> zope.configuration machinery. It's passed in to the 'grok' ZCML
> directive implementation as implemented in grokcore.component.zcml.
Aha, I see. So it's passed around in kwargs from that point onwards?
> > I'm also not quite sure how to use config.action() to ensure that my
> > particular callable gets executed after all standard components have been set
> > up, though I guess that's a zope.configuration question?
>
> Give it an 'order' argument.
Thanks a lot! I'm going to try this out tonight, hopefully. It sounds kind
of fun. :)
Cheers,
Martin
More information about the Grok-dev
mailing list