[Grok-dev] megrok.menu 0.2 released

Jeroen Michiel jmichiel at yahoo.com
Wed Apr 15 04:37:49 EDT 2009


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.



More information about the Grok-dev mailing list