[Grok-dev] Re: ZCML

Dennis Noordsij dennis.noordsij at movial.fi
Thu Jul 31 13:31:20 EDT 2008


>> In ZCML, you would register "Home" as a viewlet, and all would be well.
>> In Grok, the grokker groks :) the menuitem itself, and I am not sure the
>> "Home" would be picked up at all.
> 
> Did you try using grok.baseclass() on menuitem? grok.baseclass()
> prevents Grok from registering classes, and is meant to prevent base
> classes from being picked up.

Ah! Fantastic, it works exactly as expected now! (and only took 10 lines
of python to test, no zcml! :)



> Once you got your mini framework for menus going I'd be quite interested
> in seeing this extracted as a megrok.viewletmenu or something, so we can
> experiment with it. Note that Philipp recently ported Zope 3's menus
> system (non-viewlet based) to Grok too, with megrok.menu. I think
> eventually we need to consider including one of them into the Grok core.

That would be interesting; have to figure some details (like which item
is active right now, url resolving / sites, etc), but I'll try to
extract something useful, a tutorial if anything, out of it.

As for megrok.*, is there a framework or howto with the boilerplate
stuff filled in ? (as in:
how-to-write-megrok.helloworld-and-use-it-in-your-app-the-egg-way)

Thanks again for the grok.baseclass() hint!

Cheers,
Dennis




More information about the Grok-dev mailing list