#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)
Change History (8)
by , 17 years ago
| Attachment: | 8376-r8418.diff added |
|---|
comment:1 by , 17 years ago
| milestone: | → 1.0 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
The proposed patch also fixes a bug occuring when settings.FORCE_SCRIPT_NAME is set.
comment:3 by , 17 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 , 17 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 , 17 years ago
| Attachment: | 8376-r8418-2.diff added |
|---|
comment:5 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Sounds believable. Need to check it does the right thing always, but this looks like a change that would be needed.