Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8376 closed (fixed)

Flatpages middleware should use path_info

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

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 8 years ago.
8376-r8418-2.diff (1.2 KB) - added by Joost Cassee 8 years ago.

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by Joost Cassee

Attachment: 8376-r8418.diff added

comment:1 Changed 8 years ago by Malcolm Tredinnick

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 Changed 8 years ago by Samori Gorse

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

comment:3 Changed 8 years ago by Malcolm Tredinnick

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 Changed 8 years ago by Joost Cassee

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.

Changed 8 years ago by Joost Cassee

Attachment: 8376-r8418-2.diff added

comment:5 Changed 8 years ago by Malcolm Tredinnick

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 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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