auth.wiki menu

168 views
Skip to first unread message

Paolo valleri

unread,
Jan 15, 2013, 11:23:59 AM1/15/13
to web...@googlegroups.com
Hi all, 
I started using the wiki. I created my pages, and I edited the wiki-menu page as I like.
Now I want to have response.menu populated with the wiki pages too  in every page I have, is there a way to populate it calling somehow auth.wiki or I have to do that by hand, updating each time menu.py? 

Thanks, Paolo

Alan Etkin

unread,
Jan 15, 2013, 2:20:05 PM1/15/13
to web...@googlegroups.com
> Now I want to have response.menu populated with the wiki pages too  in every page I have, is there a way to populate it calling
> somehow auth.wiki or I have to do that by hand, updating each time menu.py?

If you put this on top of the controller (or model), you get the wiki menu

from gluon.tools import Wiki
response
.menu += Wiki(auth).menu(controller="default", function="wiki")

The controller and / or function is required since otherwise, the wiki object cannot resolve redirection to edit/search/etc., and that address should be an action that calls auth.wiki(). And also you must check the action name to avoid duplicating the sub-menu

What about an extra set of keyword arguments to activate the menu?:

auth.wiki(resolve=False, menu=True, controller=..., function=....)


paolo....@gmail.com

unread,
Jan 16, 2013, 4:07:06 AM1/16/13
to web...@googlegroups.com
Hi Alan, thank for the tip :-), it seems to work correctly.
The only issue is that when I call the function 'wiki' I get two menu, one from the ad-hoc import, the other one from the common wiki.
What shoud be nice is to explicitly tell auth.wiki when it has to populate the response.menu and when not. 
Paolo


2013/1/15 Alan Etkin <spam...@gmail.com>


--
 
 
 



--
 Paolo

Andrew W

unread,
Jan 16, 2013, 4:21:51 AM1/16/13
to web...@googlegroups.com
I just tried something like this:

if request.function != 'wiki':
   response.menu += Wiki(auth).menu(controller="default", function="wiki")

paolo....@gmail.com

unread,
Jan 16, 2013, 4:27:15 AM1/16/13
to web...@googlegroups.com
yep, this fix the problem but it is something ad-hoc, a general procedure would be better.


2013/1/16 Andrew W <awill...@gmail.com>

--
 
 
 



--
 Paolo

Alan Etkin

unread,
Jan 16, 2013, 5:29:34 AM1/16/13
to web...@googlegroups.com
yep, this fix the problem but it is something ad-hoc, a general procedure would be better.

I proposed a change to auth.wiki for enabling the menu with keword arguments:

http://code.google.com/p/web2py/issues/detail?id=1281

Reply all
Reply to author
Forward
0 new messages