I've tried you technique.
map.redirect('/{controller}/', '/{controller}')
map.connect('/articles', controller='articles', action='show',
conditions=dict(sub_domain=['my']))
When I plug in http://my.localhost.com:5000/articles/
i get redirected here:
http://my.localhost.com:5000/articles?sub_domain=my
Looks like a bug, connected to the one, I've emailed you about.
P.S.:
I've tried to play around to see how it's done by others.
http://wiki.pylonshq.com/display/pylonsdocs/Home
and
http://wiki.pylonshq.com/display/pylonsdocs/Home/
get me to the same page without redirect.
The breadcrumb changes though. Weird.
Digg can take both with and without backslash and provide the same
page.
i.e.: http://digg.com/world_business/ and http://digg.com/world_business
I personally think that it's vital to allow user to be able to get the
page he
expects to see no matter what.
Getting a 404 because of an extra slash is not an option. The question
is what
approach to take. If just rendering the same page provides all this
confusion
(Digg somehow manages to live with it) then I guess redirecting is the
way to go.
On Jan 29, 11:44 am, Pavel Skvazh <[email protected]> wrote:
> Can you also please take a look at the bug I've sent you regarding
> routes?
>
> On Jan 28, 9:16 pm, Ben Bangert <[email protected]> wrote:
>
> > On Jan 28, 2009, at 6:44 AM, Pavel Skvazh wrote:
>
> > > Is there a way (if not, is it worth adding) to tell routes to match
> > > routes with both trailing slash and without.
> > > Say to match /articles/ and /articles
> > > I have to right two identical routes just to match them both.
>
> > > I think i heard someone saying that supporting both is a bad practice.
> > > Just want some feedback from groups experience.
>
> > First, thats not good from a relative URL standpoint, since
> > constructing a relative URL on a page that matches both of those URL's
> > will lead to two different spots (one of them prolly invalid). If you
> > really want both to work, you should redirect from one to the one that
> > should be *the* page, ie:
> > map.redirect('/articles/', '/articles')
>
> > Or if you always want to redirect something ending in a slash to the
> > non-slash version:
> > map.redirect('/{controller}/, '/{controller}')
>
> > 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
-~----------~----~----~----~------~----~------~--~---