On 3.4.2011 14:03, Jason Brower wrote:
So I have been playing with the idea of having some dynamic menus and I am a bit stuck... If a user is logged in and has created a conference then they should see an extra menu item with all of the conferences they are currently organizing.I think the if users_conferences is not needed as if the users_conferences is empty the for loop is not executed. But thats not the reason why this fails. I don´t get the logic of the for list, why are you creating a list first, shouldn´t you just call the response_menu += for every event. I create the meny with pages like this:I have this in the menu.py file...if auth.is_logged_in():users_conferences = db(db.conference.creator == auth.user.id).select(orderby = db.conference.name)if users_conferences: users_conferences_list = [] for event in users_conferences:users_conferences_list.append((event.name, False, URL( 'conference', 'enter', response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [users_conferences_list ])]
pages = db((db.t_page.id > 3)&(db.t_page.f_public == True)).select(orderby=db.t_page.id)
for page in pages:response.menu += [((page.f_menu), False, URL('default', 'index', args=[page.id]), []),]
Kenneth
But I get a menu like this instead.It's almost as if the menu item code is not executed but taken as an "almost literal string".Must be something simple I am missing. --- Best Regards, Jason Brower
<<image/png>>

