On Sat, Sep 13, 2008 at 1:36 AM, Ross <[EMAIL PROTECTED]> wrote:

>
> The URL encoding is not causing any problems in my code. Splitting the
> parameter on '+' works the same whether the address is 'Goo+Goo+Dolls'
> or 'Goo%2BGoo%2BDolls'.
>
> I can certainly add additional expressions to catch URLs with and
> without the trailing slash, I was just hoping there was an option to
> do just that.
>

Change your pattern from:

r'^djangoproject/search/(?P<test>[\w\+]+)/$'

to:

r'^djangoproject/search/(?P<test>[\w\+]+)/?$'

The question mark makes the trailing slash optional -- pattern will match a
url with 0 or 1 trailing slashes.

Karen



>
> On Sep 12, 10:15 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Fri, Sep 12, 2008 at 6:06 PM, Ross <[EMAIL PROTECTED]> wrote:
> >
> > > The problem is it looks bad! It makes the URL unreadable, which is
> > > what I want to prevent. For example, last.fm uses '+' symbols to
> > > separate band names.
> >
> > >http://www.last.fm/music/Goo+Goo+Dollspretty obviously takes you to
> > > the page for the band "Goo Goo Dolls".
> >
> > >http://www.last.fm/music/Goo%2BGoo%2BDolls, however, is far tougher to
> > > pick apart by a human reader.
> >
> > > My short answer is I want to keep my URLs human readable.
> >
> > OK, so you are not actually seeing a code problem in your
> dispatching/views
> > resulting from this?  That is what I was trying to determine: whether
> your
> > code had to adapt to things coming in percent-encoded, because I didn't
> > think it should, and if it did, I'd want to track down why.
> >
> > If you just don't like how it looks in the browser address bar, then
> simply
> > avoid having it happen.  Specify your url regex expressions so that the
> > trailing slash is optional, that way APPEND_SLASH never has to get
> involved
> > and issue the redirect. Wouldn't that be easier than trying to change how
> > APPEND_SLASH works?
> >
> > Karen
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to