Mind that it is not a good idea to do this:
URL("call", "run", "Set_Page", args="77" )
i.e. pass the application name. You want instead
URL("run", "Set_Page", args="77" )
else if the app is renamed the links break.
On Oct 18, 6:52 pm, Stef Mientki <[email protected]> wrote:
> hello,
>
> I'm trying to call a service from menu buttons,
> and I read somewhere in the manual, you should always use URL()
>
> Now this works:
> LSB_Menu.append ( [ 'Stef3',"call/run/Set_Page/77" ])
>
> But the following don't (while printing the URL result, looks ok), why ??
> #LSB_Menu.append ( [ 'Stef4',URL("call", "run", "Set_Page", args="77" ) ])
> #LSB_Menu.append ( [ 'Stef5',URL("call", "run", "Set_Page", vars="77" ) ])
> #LSB_Menu.append ( [ 'Stef5',URL("call", "run", "Set_Page", "77" )])
>
> # this is the service
> from gluon.tools import Service
> service = Service(globals())
> def call():
> return service()
> @service.run
> def Set_Page(Nr):
> return dict ( m='aap',b=99,c=Nr)
>
> thanks,
> Stef Mientki