Looks like MENU doesn't generate a DOM structure until its .serialize() method is called. You could do:
mmenu = mmenu.serialize(mmenu.data) mmenu.elements('a') I'm not sure why it was done this way as opposed to generating the DOM upon initialization. Massimo? Anthony On Tuesday, September 11, 2012 10:49:59 AM UTC-4, amphisia pui wrote: > > Hi to all > > I want to use the html helper MENU to have in the page footer a menu > totally exploded without sliding items. > I changed the css classes and everything looks fine but I don't want the > first level menu items to be clickable > > so the first thing I tried was the server-side parsing to remove > unnecessary tags but in a web2py shell I got > > mlist = ... well formatted web2py menu list > > In [40]: mmenu = MENU(mlist) > > In [41]: mitems = mmenu.elements('a') > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call last) > /opt/web2py/applications/happy/models/menu.py in <module>() > ----> 1 mmenu.elements('a') > > /opt/web2py/gluon/html.pyc in elements(self, *args, **kargs) > 1079 # loop the components > > 1080 if find_text or find_components: > -> 1081 for i, c in enumerate(self.components): > 1082 if check and find_text and isinstance(c, str) and \ > 1083 ((is_regex and find_text.search(c)) or > (str(find_text) in c)): > > AttributeError: 'MENU' object has no attribute 'components' > > Is MENU helper supposed to work with sever side DOM parsing? Is web2py > ipython Shell fault? > Can you suggest something better to try to have first level items menu > seem like simple labels? > > Thanks to all > > AP > > Sys info > Python 2.7.3 > web2py 2.0.8 > > --