Changes between Version 146 and Version 147 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Dec 19, 2007, 8:14:16 AM (17 years ago)
Author:
Malcolm Tredinnick
Comment:

Document the APPEND_SLASH behaviour change.

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v146 v147  
    4646 * [6832] Dec 2, 2007: [#Settingsexceptiontypeschanged Settings exception types changed]
    4747 * [6833] Dec 2, 2007: [#Genericviewsemptydefaults Generic views' empty defaults]
    48  * [6838] Dec. 3, 2007: [#MultipleObjectsReturnedexceptioninsteadofAssertionError MultipleObjectsReturned exception instead of AssertionError]
     48 * [6838] Dec. 2, 2007: [#MultipleObjectsReturnedexceptioninsteadofAssertionError MultipleObjectsReturned exception instead of AssertionError]
     49 * [6852] Dec. 2, 2007: [#ChangetoAPPEND_SLASHbehaviour Change to APPEND_SLASH behaviour]
    4950 * [6915] Dec 12, 2007 [#ModelFormsconstructornowmatchesForms ModelForm's constructor now matches Form's]
    5051
     
    510511}}}
    511512
     513== Change to APPEND_SLASH behaviour ==
     514
     515Prior to [6852], if a URL didn't end in a slash or have a period in the final component of it's path, and {{{APPEND_SLASH}}} was True, Django would redirect to the same URL, but with a slash appended to the end.
     516
     517Now (from [6852] onwards), Django checks to see if the pattern without the trailing slash would be matched by something in your URL patterns. If so, no redirection takes place, because it is assumed you deliberately wanted to catch that pattern.
     518
     519For most people, this won't require any changes. Some people, though, have URL patterns that look like this:
     520{{{
     521#!python
     522r'/some_prefix/(.*)$'
     523}}}
     524Previously, those patterns would have been redirected to have a trailing slash. If you always want a slash on such URLs, rewrite the pattern as
     525{{{
     526#!python
     527r'/some_prefix/(.*/)$'
     528}}}
     529Now {{{/some_prefix/foo}}} will not match the pattern and will be redirected to {{{/some_prefix/foo/}}}, which will match. Your view function will be passed {{{foo/}}}, just as it was prior to [6852].
     530
    512531== !ModelForm's constructor now matches Form's ==
    513532
Back to Top