Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8376 closed (fixed)

Flatpages middleware should use path_info

Reported by: Joost Cassee Owned by: nobody
Component: Contrib apps Version: dev
Severity: Keywords: flatpages
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The django.contrib.flatpages middleware looks up request.path as a Flatpage URL. Since changeset [8015] this should be request.path_info. Trivial patch attached.

Attachments (2)

8376-r8418.diff (680 bytes ) - added by Joost Cassee 16 years ago.
8376-r8418-2.diff (1.2 KB ) - added by Joost Cassee 16 years ago.

Download all attachments as: .zip

Change History (8)

by Joost Cassee, 16 years ago

Attachment: 8376-r8418.diff added

comment:1 by Malcolm Tredinnick, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedAccepted

Sounds believable. Need to check it does the right thing always, but this looks like a change that would be needed.

comment:2 by Samori Gorse, 16 years ago

The proposed patch also fixes a bug occuring when settings.FORCE_SCRIPT_NAME is set.

comment:3 by Malcolm Tredinnick, 16 years ago

Patch needs improvement: set

This has the same problem as mentioned in comment 3 of #8381: if a redirect is required inside the django.contrib.flatpages.views.flatpage() function, it no longer has the correct URL to redirect to (the script name portion has been discarded). So some extra information needs to be passed in there (it can be a parameter with a default value to preserve backwards compatibility).

comment:4 by Joost Cassee, 16 years ago

Patch needs improvement: unset

The updated patch works on my (SCRIPT_NAME-enabled) test set-up. Note that the patch uses the supplied request parameter instead of adding an extra parameter. I believe we can use request.path to redirect.

by Joost Cassee, 16 years ago

Attachment: 8376-r8418-2.diff added

comment:5 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [8457]) Fixed #8376 -- Use request.path and request.path_info at the right moments when
serving data in the flatpage middleware. Patch from jcassee.

comment:6 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top