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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to