Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
APPEND_SLASH alternative
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mihai Preda  
View profile  
 More options Jan 3 2007, 4:41 am
From: "Mihai Preda" <mpr...@gmail.com>
Date: Wed, 03 Jan 2007 01:41:11 -0800
Local: Wed, Jan 3 2007 4:41 am
Subject: APPEND_SLASH alternative
Hi,

now APPEND_SLASH works like this: for any URL which doesn't end with a
slash, and whose last segment doesn't contain a dot "." (the dot which
typically indicates the file extension), an HTTP-redirect is generated
to an URL formed from the initial URL with a slash appended.

I'd like to propose an alternative way of handling the 'end-slash'
problem, like this:

If the initial URL doesn't end with a slash, and it is not found in
urlpatterns, a new URL is formed by appending a slash at the end. If
this new URL is found in urlpatterns, then an HTTP-redirect is returned
to this new URL; otherwise the initial URL is processed as usual.

This behavior emulates the serving of filesystem-based files and
directories, where a request for a directory without slash at the end
results in a redirect with the slash appended; but a request for a file
(regardless whether the file has a dot or not) doesn't append a slash.

I consider this way of handling the end-slash to be a better
altervative over the two choices that exist now (APPEND_SLASH=True or
APPEND_SLASH=False), as it somehow merges together these two modes. It
also handles uniformilly URLs that have or don't have a dot in the last
segment, which is good.

Cheers,
Mihai Preda


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Bennett  
View profile  
 More options Jan 3 2007, 2:57 pm
From: "James Bennett" <ubernost...@gmail.com>
Date: Wed, 3 Jan 2007 13:57:50 -0600
Local: Wed, Jan 3 2007 2:57 pm
Subject: Re: APPEND_SLASH alternative
On 1/3/07, Mihai Preda <mpr...@gmail.com> wrote:

> If the initial URL doesn't end with a slash, and it is not found in
> urlpatterns, a new URL is formed by appending a slash at the end. If
> this new URL is found in urlpatterns, then an HTTP-redirect is returned
> to this new URL; otherwise the initial URL is processed as usual.

Hm. My first impression is that I like it, mostly for the reasons
you've outlined; I had to turn off APPEND_SLASH when I decided I
didn't want trailing slashes on individual entries on my weblog,
because it would add them regardless of whether the slash-less URL
matched anything.

I also like that you've suggested not doing the redirect unless the
"slashified" URL would actually match something; being able to just
404 immediately on something that won't match is nice.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donny  
View profile  
 More options Jan 4 2007, 1:31 am
From: "Donny" <donny.viszn...@gmail.com>
Date: Thu, 04 Jan 2007 06:31:51 -0000
Local: Thurs, Jan 4 2007 1:31 am
Subject: Re: APPEND_SLASH alternative
I think it would be nice if the process for implementing your own URL
dispatcher were more obvious / accessible. I have several friends who
have told me they had a want for this, and that it took more effort
than it should have. I haven't had to do it myself yet, but I would
have if I had known there was an established method for doing it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mihai Preda  
View profile  
 More options Jan 4 2007, 8:56 am
From: "Mihai Preda" <mpr...@gmail.com>
Date: Thu, 04 Jan 2007 05:56:49 -0800
Local: Thurs, Jan 4 2007 8:56 am
Subject: Re: APPEND_SLASH alternative
I submitted a new middleware (tentativelly named SmartSlashMiddleware)
which implements the described behavior, in ticket #3228.

A couple of minor refactorings which are needed by this class are in
ticket #3224.

I hope somebody can review these patches, and commit them after
eventual fixes.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »