Opened 18 years ago

Closed 17 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: dev
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

Description

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 by James Bennett, 18 years ago

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 by Matt, 18 years ago

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:

MIDDLEWARE_CLASSES = (
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
)

comment:3 by Rob Hudson <treborhudson@…>, 18 years ago

Cc: treborhudson@… added

comment:4 by Chris Beaven, 18 years ago

Triage Stage: UnreviewedAccepted

Sounds like a bug to me.

comment:5 by Marc Fargas <telenieko@…>, 17 years ago

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 by orestis@…, 17 years ago

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 by Simon G. <dev@…>, 17 years ago

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