Django

Code

Ticket #8376 (closed: fixed)

Opened 4 months ago

Last modified 3 months ago

Flatpages middleware should use path_info

Reported by: jcassee Assigned to: nobody
Milestone: 1.0 Component: Contrib apps
Version: SVN Keywords: flatpages
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

8376-r8418.diff (0.7 kB) - added by jcassee on 08/17/08 08:00:23.
8376-r8418-2.diff (1.2 kB) - added by jcassee on 08/18/08 07:05:03.

Change History

08/17/08 08:00:23 changed by jcassee

  • attachment 8376-r8418.diff added.

08/17/08 10:50:16 changed by mtredinnick

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • milestone set to 1.0.

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

08/17/08 13:53:48 changed by Samori Gorse

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

08/17/08 15:49:52 changed by mtredinnick

  • needs_better_patch set to 1.

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).

08/18/08 07:04:47 changed by jcassee

  • needs_better_patch deleted.

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.

08/18/08 07:05:03 changed by jcassee

  • attachment 8376-r8418-2.diff added.

08/20/08 20:40:22 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #8376 (Flatpages middleware should use path_info)




Change Properties
Action