Hi,<br><br>this is a limitation in megrok.menu, but I&#39;m not sure if it&#39;s a megrok.menu limitation or a grokking limitation. <br><br>The thing is that, as far I understand, the grokking order can be set within the same module, that&#39;s why if you put, menus and views in the same file, things are right grokked. You may want to take a look to this thread [1]<br>
<br>What you could try to do is this:<br><br>instead of just a file called menus.py, create a folder, let&#39;s say: <br><br>grokapp/<br>  src/<br>     grokapp/<br>        configure.zcml<br>        app.py<br>        menus/<br>
           - __init__.py<br>           - menus.py<br>           - configure.zcml<br><br>Put your menus definitions in menus.py and in `configure.zcml` put<br><br>&lt;configure xmlns=&quot;<a href="http://namespaces.zope.org/zope">http://namespaces.zope.org/zope</a>&quot;<br>
           xmlns:grok=&quot;<a href="http://namespaces.zope.org/grok">http://namespaces.zope.org/grok</a>&quot;&gt;<br>  &lt;grok:grok package=&quot;.&quot; /&gt;<br><br>&lt;/configure&gt;<br><br>Now, in the main configure.zcml in your grok application you should do:<br>
<br>&lt;configure xmlns=&quot;<a href="http://namespaces.zope.org/zope">http://namespaces.zope.org/zope</a>&quot;<br>           xmlns:grok=&quot;<a href="http://namespaces.zope.org/grok">http://namespaces.zope.org/grok</a>&quot;&gt;<br>
  &lt;include package=&quot;grok&quot; /&gt;<br><br>  &lt;includeDependencies package=&quot;.&quot; /&gt;<br><br>  &lt;!-- Here we force that menus module it&#39;s grokked first that nothing --/&gt;<br>  &lt;include package=&quot;.menus&quot; /&gt;<br>
<br>  &lt;grok:grok package=&quot;.&quot; /&gt;<br><br>&lt;/configure&gt;<br><br>By doing this, you should be able to define your views in the app.py file and register menuitems in the menus defined inside `menus` module.<br>
<br>Hope it helps<br><br>Best Regards<br><br>[1] <a href="http://mail.zope.org/pipermail/grok-dev/2008-December/006824.html">http://mail.zope.org/pipermail/grok-dev/2008-December/006824.html</a><br><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2009/4/15 Jeroen Michiel &lt;<a href="mailto:jmichiel@yahoo.com">jmichiel@yahoo.com</a>&gt;:<br>

<div><div></div><div class="h5">&gt;<br>
&gt; I seem to be having problems with the order of &#39;grokking&#39;:<br>
&gt; I put all my menu definitions in &#39;menus.py&#39; and then add views to these<br>
&gt; menus by name.<br>
&gt; For instance I have a<br>
&gt;<br>
&gt; class VersionTasksMenu(megrok.menu.Menu):<br>
&gt;    <a href="http://grok.name" target="_blank">grok.name</a>(&#39;version-tasks&#39;)<br>
&gt;    grok.title(&#39;Tasks&#39;)<br>
&gt;    grok.description(&#39;All you can do on a version&#39;)<br>
&gt;<br>
&gt; Then in another file where views for a specific model are defined I have<br>
&gt; class AddCandidateView(grok.View):<br>
&gt;    grok.context(IVersion)<br>
&gt;    grok.template(&#39;default&#39;)<br>
&gt;    <a href="http://grok.name" target="_blank">grok.name</a>(&#39;addcandidate&#39;)<br>
&gt;    grok.title(&#39;Add a Candidate&#39;)<br>
&gt;    grok.description(&#39;Add a new Candidate to the list of candidates for this<br>
&gt; video&#39;)<br>
&gt;    megrok.menu.menuitem(&#39;version-tasks&#39;)<br>
&gt;<br>
&gt; And Grok keeps complaining with:<br>
&gt;  GrokError: The u&#39;version-tasks&#39; menu could not be found.  Please use<br>
&gt; megrok.menu.Menu to register a menu first.<br>
&gt;<br>
&gt; The only way to solve it is to add the menu definition in the same file as<br>
&gt; the view and above it.<br>
&gt; This is not the way I want my code structured, however (there may be other<br>
&gt; views that will be registered to this menu in other files later on)! How can<br>
&gt; I fix this? can I somehow &#39;force&#39; the grokking order, or does this need to<br>
&gt; be solved in megrok.menu?<br>
&gt;<br>
&gt; Another question: I saw there also is a z3c.menu.ready2go package, which<br>
&gt; seems more powerful. Would this be a big deal getting it to work in Grok (I<br>
&gt; figure i&#39;d have to be writing some zcml, judging from the PyPI docs)?<br>
&gt; --<br>
&gt; View this message in context: <a href="http://www.nabble.com/megrok.menu-0.2-released-tp22291198p23054977.html" target="_blank">http://www.nabble.com/megrok.menu-0.2-released-tp22291198p23054977.html</a><br>
&gt; Sent from the Grok mailing list archive at Nabble.com.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Grok-dev mailing list<br>
&gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
&gt;<br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Santiago Videla<br><a href="http://www.revolucionesweb.com.ar">www.revolucionesweb.com.ar</a><br><a href="http://www.linkedin.com/in/svidela">http://www.linkedin.com/in/svidela</a><br>
<br>Sigue la mata dando de que hablar siempre abajo y a la izquierda donde el pensamiento que se hace corazón resplandece con la palabra sencilla y humilde que l@s tod@s somos.<br>