this is an old thread, but I needed to do add a conditional piece to a menu
- but had trouble with all the options below.
Then I realized that response.menu is a list, hence rather than
if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
response.menu += [('Admin', False
i found the same difficulty during add conditional sub menu, in my case the
conditional is base on session. i've followed cliff hints above using
sub_menu = [], it work well as long as the condition is meet (there is a
session), but the problem occured when i clear the session.
is there any sol
Sorry I didn't see this sooner.
I think all your menu items will want that empty list, and I see some do
not.
Also I am confused about how a menu script could cause a dal to raise an
exception. Maybe somebody with a better knowledge of the internals will
chime in here.
On Wednesday, April 25
Thanks again ! I came back from vacation and tried the code but I got
different error...
File "C:\web2py\gluon\dal.py", line 1386, in log_execute
ret = self.cursor.execute(*a, **b)
ProgrammingError: The cursor's connection has been closed.
sub_menu = [('Admin', False, URL('admin'), []),
Cliff,
Thanks ! I'm on vacation but I will try when I come back but I'm sure it
works !!
On Sun, Apr 15, 2012 at 9:52 PM, Cliff wrote:
> Omi,
>
> Sorry, my bad. Been away.
>
> Should be:
> sub_menu = [('Admin', False, URL('admin'), []), ] # Added empty list
>
> On Thursday, April 12, 20
Omi,
Sorry, my bad. Been away.
Should be:
sub_menu = [('Admin', False, URL('admin'), []), ] # Added empty list
On Thursday, April 12, 2012 9:43:39 AM UTC-4, Omi Chiba wrote:
>
> Cliff,
>
> Thank you for sharing code but now I got a different error. Maybe it
> cannot understand sub_menu
Nice approach. I will try for my another project !
On Thursday, April 12, 2012 5:18:58 AM UTC-5, Javier wrote:
>
> I was working on a set menu from the database. It's simple and it can be
> useful.
> The model is simple, and has a condition to evaluate options when
> generating the menu items.
>
Cliff,
Thank you for sharing code but now I got a different error. Maybe it cannot
understand sub_menu contains three parameters..
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
File "C:\web2py\applications\home
I was working on a set menu from the database. It's simple and it can be
useful.
The model is simple, and has a condition to evaluate options when
generating the menu items.
The evaluation was done using the function 'eval'.
Attach model.
To manage SQLFORM.grid use or what you like
db.define_table
I have something like this working:
sub_menu = []
if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
sub_menu = [('Admin', False, URL('admin')), ]
response.menu = [('Home', False, URL('home','default','index'), []),
(SPAN('Price List',_style='color:yellow'), True,
UR
10 matches
Mail list logo