Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8376 closed (fixed)

Flatpages middleware should use path_info

Reported by: jcassee 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:


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

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by jcassee

comment:1 Changed 8 years ago by mtredinnick

  • milestone set to 1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 mtredinnick

  • 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 jcassee

  • 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 jcassee

comment:5 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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 deleted

Milestone 1.0 deleted

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