On Wed, Aug 20, 2008 at 3:59 PM, EricHolmberg
<[EMAIL PROTECTED]> wrote:
>
> I'm seeing an issue with the usage of path_info (used to adjust the
> PATH_INFO and SCRIPT_NAME variables) with url_for(...) which results
> in the path leading up to the *path_info showing up as the URL for the
> root controller. I'm not sure if this is intended. If so, any ideas
> on how to get the URL for the root controller?
>
> Example code
> ---------------------
> routing.py make_app() code:
>
> map.connect('WikiSystem/*path_info', controller='EmbeddedTrac',
> path_info='/')
>
> Creating a URL using this code:
> h.url_for('/')
>
> results in /WikiSystem/ instead of /. Is this expected? Any ideas on
> how to get the root controller URL?
>
> OS: Windows XP
> Python 2.5
> Pylons 0.9.6.2
> Routes 1.9.2
You're using *var with a default value, and the magic *path_info on
top of that. All of these could interact in unexpected ways. It
would be better to make two or three specific routes for these cases,
and to use named routes for generation. That minimizes the ambiguity.
So do something like:
map.connect("home", "/", controller="main", action="index")
map.connect("wiki", "/WikiSystem", controller="EmbeddedTrac", path_info="/")
map.connect("/WikiSystem/*path_info", controller="EmbeddedTrac")
h.url_for("home")
h.url_for("wiki")
I'm not sure if path_info is strictly necessary with the second one,
or if the second and third can be combined. But it's a matter of how
long you want to take trying things out.
Routes 2 is slated to have direct delegation to WSGI apps, something like
map.wsgi("/WikiSystem", EmbeddedTrac).
--
Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---