wonderful! thanks, Massimo
On Jul 18, 11:53 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> On Jul 19, 1:32 am, Dan <danbr...@gmail.com> wrote:
>
> > I'm putting together a quick routine to assemble a horizontal menu bar
> > in my layout.html file (does one already exist? I only saw the one
> > called MENU() to create vertical menus).
>
> Yes,
>
> {{=MENU(response.menu,_class="web2py-menu web2py-menu-horizontal")}}
>
> I thought it would be a
>
> > simple map-reduce operation, but I'm getting a strange result. Here is
> > the code in my view file:
>
> > {{=response.write(' | '.join(map(lambda m:'<a href="%s">%s</a>'%
> > (m[2],m[0]),response.menu_user)),False)}}{{pass}}
>
> > which produces this (from View Source):
> > <a href="/user/login">Login</a> | <a href="/user/register">Register
> > for a new account</a>None
>
> > I can't figure out why the "None" is being added at the end. Looking
> > at the examples on this page, I see a different approach using a for:
> > loop, so I tried that and sure enough, the results do not have a
> > "None" hanging on to the end.
>
> Becuase these two are equivalent:
>
> {{response.write(' | '.join(map(lambda m:'<a href="%s">%s</a>'% (m[2],m
> [0]),response.menu_user)),False)}}
>
> {{=XML(' | '.join(map(lambda m:'<a href="%s">%s</a>'% (m[2],m
> [0]),response.menu_user)))}}
>
> but response.write returns None
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---