I think we need to have three new arguments to url_for:

params (dict) - used to create the query string (while deprecating the
keyword args method, just like the comment about turbogears
mentioned).
raw (boolean) - if true then the url is presumed to raw so we don't
try to do a routing map match.
external (boolean) - if true then don't add the SCRIPT_NAME as prefix.

With the above options, you don't need to create a new "redirect"
call, so users can use the current "redirect_to" (which would pass
these args to url_for) and specify options such as raw, external or a
params hash.





On Jan 5, 9:54 am, Ben Bangert <[email protected]> wrote:
> On Jan 4, 2009, at 2:29 PM, Tycon wrote:
>
>
>
> > from the "url_for" doc string :
>
> >    If no route by that name is found, the string is assumed to be a
> > raw URL.
> >    Should the raw URL begin with ``/`` then appropriate SCRIPT_NAME
> > data will
> >    be added if present, otherwise the string will be used as the url
> > with
> >    keyword args becoming GET query args.
>
> > But what if I don't want to SCRIPT_NAME to be prefixed to the URL
> > because it's a link for a different application ?   For example if
> > pylons app has SCRIPT_NAME of "/pylons" but I want to create a URL for
> > "/blog/newposts" which is served an a different blog application (so
> > it should not be converted to /pylons/blog/newposts) ?
>
> > Normally I wouldn't need to call url_for in this case, and just use
> > the external URL directly, but
> > if I need  to do a redirect using pylons redirect_to it will
> > internally call url_for and add the SCRIPT_NAME
> > prefix.
>
> Right, this is why Pylons will have a redirect() function that does  
> not pass the args through redirect_to. It's included in the latest  
> Pylons 0.9.7 tip code (soon to be released as final), but isn't yet  
> used as the default as we wanted the book to be accurate for at least  
> one released version of Pylons. :)
>
> Cheers,
> Ben
>
>  smime.p7s
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to