[Grok-dev] megrok.menu 0.2 released

Souheil CHELFOUH trollfot at gmail.com
Wed Apr 15 07:22:04 EDT 2009

When I asked Phillip, it seemed obvious to him that it was normal
because grokked in alpha order
if your menu is placed in a file starting with a "_", for instance, it
will work. I tried and it does.
I just don't understand why the grokkers order is not working properly
here, to keep a clean code.

About more features on the menu side, check Christian work :


2009/4/15 Jeroen Michiel <jmichiel at yahoo.com>:
> I seem to be having problems with the order of 'grokking':
> I put all my menu definitions in 'menus.py' and then add views to these
> menus by name.
> For instance I have a
> class VersionTasksMenu(megrok.menu.Menu):
>    grok.name('version-tasks')
>    grok.title('Tasks')
>    grok.description('All you can do on a version')
> Then in another file where views for a specific model are defined I have
> class AddCandidateView(grok.View):
>    grok.context(IVersion)
>    grok.template('default')
>    grok.name('addcandidate')
>    grok.title('Add a Candidate')
>    grok.description('Add a new Candidate to the list of candidates for this
> video')
>    megrok.menu.menuitem('version-tasks')
> And Grok keeps complaining with:
>  GrokError: The u'version-tasks' menu could not be found.  Please use
> megrok.menu.Menu to register a menu first.
> The only way to solve it is to add the menu definition in the same file as
> the view and above it.
> This is not the way I want my code structured, however (there may be other
> views that will be registered to this menu in other files later on)! How can
> I fix this? can I somehow 'force' the grokking order, or does this need to
> be solved in megrok.menu?
> Another question: I saw there also is a z3c.menu.ready2go package, which
> seems more powerful. Would this be a big deal getting it to work in Grok (I
> figure i'd have to be writing some zcml, judging from the PyPI docs)?
> --
> View this message in context: http://www.nabble.com/megrok.menu-0.2-released-tp22291198p23054977.html
> Sent from the Grok mailing list archive at Nabble.com.
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev

More information about the Grok-dev mailing list