I'm working on a Pylons project (only about midway through
development) and I ran into this same issue.
Essentially, I want people to be able to visit a section by going to
<url>/<section name>, so I added this generic line at the end of the
routes file:
map.connect('/{title}', controller='main', action='section')
The controller action then starts with this:
def section(self, title):
title = title.lower()
That way it always queries the section name in lowercase (looking for
an exact match to the lowercase name in the database) regardless of
how it was typed in, or returns 404 if there is no page with that
name. It works, but will this be a problem for Google rankings or
anything else?
Eric
On Jul 13, 7:47 pm, Mike Orr <[email protected]> wrote:
> On Tue, Jul 13, 2010 at 5:29 PM, Ross Vandegrift <[email protected]> wrote:
> > On Tue, Jul 13, 2010 at 11:37:29AM -0700, Mike Orr wrote:
> >> You may be able to do it with a catchall route and a function condition.
>
> >>http://routes.groovie.org/setting_up.html#conditions
>
> >> Or you could subclass Routes to lowercase the URL before matching it.
>
> > Or you can do it the silly and tedious way, which doubles as
> > motivation to avoid requiring case-insensitive routes!
>
> > map.connect(r"/[Gg][Rr][Oo][Uu][Pp][Ss]/{action}", controller="groups")
>
> Regex markup is not officially supported in route paths except in
> requirement arguments, so I wouldn't count on this always working.
>
> --
> 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.