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