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 <cjk...@gmail.com> wrote: > 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 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\**views\default/index.html", line >> 64, in <module> >> File "C:\web2py\gluon\globals.py", line 182, in write >> self.body.write(xmlescape(**data)) >> File "C:\web2py\gluon\html.py", line 114, in xmlescape >> return data.xml() >> File "C:\web2py\gluon\html.py", line 2146, in xml >> return self.serialize(self.data, 0).xml() >> File "C:\web2py\gluon\html.py", line 2121, in serialize >> li.append(self.serialize(item[**3], level+1)) >> File "C:\web2py\gluon\html.py", line 2109, in serialize >> (name, active, link) = item[:3] >> ValueError: need more than 0 values to unpack >> >> On Wednesday, April 11, 2012 11:00:30 PM UTC-5, Cliff wrote: >>> >>> 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, >>> URL('pricelist','default','**index'), >>> [('Guideline', False, URL('pricelist','default','**guideline')), >>> ('Multiplier Tables', False, URL('pricelist','default','** >>> multitable')), >>> ('Cut Charge Tables', False, URL('pricelist','default','** >>> cuttable')), >>> (sub_menu), >>> ])] >>> >>> On Wednesday, April 11, 2012 12:24:29 PM UTC-4, Omi Chiba wrote: >>>> >>>> The following menu works. It's add "Admin" menu next to "Price List" if >>>> the user has role "admin". Now, I want to add the "Admin" menu as sub-menu >>>> of "Price List" where it's right after the "Cut Charge Tables". How can I >>>> do this ? >>>> >>>> response.menu = [('Home', False, URL('home','default','index'), []), >>>> (SPAN('Price List',_style='color:yellow'), True, >>>> URL('pricelist','default','**index'), >>>> [('Guideline', False, URL('pricelist','default','**guideline')), >>>> ('Multiplier Tables', False, URL('pricelist','default','** >>>> multitable')), >>>> ('Cut Charge Tables', False, URL('pricelist','default','** >>>> cuttable')), >>>> ])] >>>> >>>> if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))): >>>> response.menu += [('Admin', False, URL('admin')), ] >>>> >>>