Johann,

I think there is miss closed bracket in the first example of what you want.

And, I am not sure that you really want a "+=" to combine your submenu,
since they get add to the first level of the menu that way, maybe you want
.append() or maybe you can "+=" but you will need some more "[]".

Richard

On Mon, Jul 16, 2012 at 8:18 AM, Johann Spies <johann.sp...@gmail.com>wrote:

> I want to break up the following code to  make it more modular, but I
> could so far not get it right:
>
> r
> esponse.menu = [
>     (T('Home'), URL('default', 'index') == URL(), URL('default', 'index'),
> []),
> ]
>
> akb_menu = [(T('Africa Knowledgebase'), False, None,
>              [ (T('Articles'), False, None,
>                   [
>                     (T('Add article'), False, URL(request.application,
> 'articles', 'kryskrywers')),
>
>                     ]),
>                (T('Journals'), False, None,
>                 [
>                     (T('List all journals'), False, URL(request.
> application, 'journal', 'journals')),
>                     ]),
>                (T('Authors'), False, None,
>                 [
>                      (T('Add author'), False, URL(request.application,
> 'authors', 'add_author')),
>                     ]),
>
>                (T('Publications statistics'), False, URL(request.
> application, 'default', 'sa_pubstats')),
>                     ]
>                 )
>                ]
>              )
>             ]
>
>
> response.menu += akb_menu
>
>  I want to get the same result as the above menu using this approach:
>
>
> response.menu = [
>     (T('Home'), URL('default', 'index') == URL(), URL('default', 'index'),
> []),
> ]
> akb_menu = [(T('Africa Knowledgebase'), False, None,)]
>
>
> art_menu =   [ (T('Articles'), False, None,
>                 [
>                     (T('Add article'), False, URL(request.application,
> 'articles', 'kryskrywers')),
>
>             ])]
>
> auth_menu =   [ (T('Authors'), False, None,
>                 [
>                      (T('Add author'), False, URL(request.application,
> 'authors', 'add_author')),
>                     ])]
>
> jrn_menu =   [(T('Journals'), False, None,
>                 [
>                     (T('List all journals'), False, URL(request.
> application, 'journal', 'journals')),
>                     ])]
>
> stat_menu = [(T('Publications statistics'), False, URL(request.application
> , 'default', 'sa_pubstats'))]
> for mn in [art_menu, auth_menu, jrn_menu, stat_menu]:
>     akb_menu += mn
>
>
>
> response.menu += akb_menu
>
> Can somebody help me to see where  I made the mistake please.
>
> Regards
> Johann.
>
>

Reply via email to