Opened 13 years ago

Closed 12 years ago

#1859 closed defect (invalid)

Flat page URLs send broken-link emails when SEND_BROKEN_LINK_EMAILS set to true

Reported by: Matt Owned by: Adrian Holovaty
Component: Contrib apps Version: master
Severity: normal Keywords: SEND_BROKEN_LINK_EMAILS flat page flatpage flatpages
Cc: treborhudson@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When SEND_BROKEN_LINK_EMAILS is set to true in a project's settings file, an email is sent to site managers even when a flat page is retreived.

Change History (7)

comment:1 Changed 13 years ago by James Bennett

I wonder if this isn't dependent on the order of middleware classes; do you still see this if you have FlatpageFallbackMiddleware listed before CommonMiddleware (since in that case the flatpage middleware should catch the request and prevent a 404 from being raise before CommonMiddleware sends the email)?

comment:2 Changed 13 years ago by Matt

I have FlatpageFallbackMiddleware listed above all other middleware classes (purely by accident I think), so order doesn't seem to affect this. My middleware classes are ordered as follows:


comment:3 Changed 12 years ago by Rob Hudson <treborhudson@…>

Cc: treborhudson@… added

comment:4 Changed 12 years ago by Chris Beaven

Triage Stage: UnreviewedAccepted

Sounds like a bug to me.

comment:5 Changed 12 years ago by Marc Fargas <telenieko@…>

This ticket was opened one year ago, could somebody confirm it? I've looked at the code and there's no reason why FlatPages should be returning a 404 to the next middleware.

comment:6 Changed 12 years ago by orestis@…

Component: Core frameworkContrib apps

I've seen this too, it does happen when the flatpages middleware is at the top of the list.

The docs specify that the flatpage middleware should be last, as it is a last resort. However, elsewhere, it is noted that the response middleware is evaluated in reverse order. So I think this is what makes this confusing. If you put the flatpage middleware last on the list, it's response function is processed first and CommonMiddleware isn't run.

I think the flatpage docs should be changed to tell you that the flatpage middleware should be placed *AFTER* the CommonMiddleware, in order to prevent this from happening.

So, for the OP: Move the flatpages middleware after CommonMiddleware.

comment:7 Changed 12 years ago by Simon G. <dev@…>

Resolution: invalid
Status: newclosed

Ok, I'm closing this as invalid as it appears to be a docs issue w.r.t middleware ordering and not the flatpages app.

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