normally you would call the URL function this way:
URL('application','controller','function',args=[], vars={})
as a shortcut URL can figure the application, the controller and the
function from the current request
URL(r=request) is the url currently requested
and you can override for example the function
URL(r=request, f='index')
Hope this helps. I am considering making r=request be there by default
but it is not easy to make in a backward compatible way.
Massimo
On May 24, 3:28 pm, Omar Munk <[email protected]> wrote:
> Thanks, and indeed. I also want to know what r = request is for.
>
> 2009/5/24 weheh <[email protected]>
>
>
>
> > redirect is meant to send the web page to a URL address. I haven't
> > tried it myself, but I assume you could say
> > redirect("http://www.google.com")
> > URL(r=request,f='first') will generate a url that will direct you to
> > your application's function named 'first'.
> > The URL function does the heavy lifting in terms of generating the
> > full URL path, which can often be complex to do by hand so it's quite
> > useful. Look at p. 102 in the doc for info on the URL function.
> > I'm not 100% sure that you need the r=request argument in your call.
> > Maybe someone else can elucidate on that.
>
> > On May 24, 4:16 pm, Pynthon Pynthon <[email protected]> wrote:
> > > Hello
>
> > > I'm getting confused. Can someon explain this code?
>
> > > redirect(URL(r = request, f = "first"))
>
> > > I know it says redirect to a function. But why the URL and why the r =
> > > request. I can't find anything in the book about it.
>
> > > Thanks,
> > > Pynthon
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---