Ok, I've tried to dumb things down, and it turns out the built-in
flatpage fallback middleware ALSO doesn't have it's process_response
called. I can only assume a response is sent before the middleware is
reached, but I've got a pretty standard setup:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'applecore.main.middleware.PageFallbackMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
)
On Nov 20, 1:54 pm, jwpeddle <[EMAIL PROTECTED]> wrote:
> I've got a custom middleware class (nearly identical in function to
> the flat page fallback middleware). When I have DEBUG = True, it works
> as expected. When I have DEBUG = False, I get errors stemming from
> variables set by the middleware not existing for the templates. After
> investigating, the only progress I've made is confirming that the
> class is called somehow (a print statement just inside the class will
> print) but the process_response never is.
>
> Again, this works when debugging is on. Perfectly. Not at all when
> it's off. Not on apache and not on the dev server. I apologize for the
> lack of errors, but I haven't narrowed it down enough yet to get any
> relevant errors.
>
> class PageFallbackMiddleware():
> def process_response(self, request, response):
> if response.status_code != 404:
> return response # No need to check for a flatpage for
> non-404 responses.
> try:
> return page(request, request.path)
> # Return the original response if any errors happened. Because
> this
> # is a middleware, we can't assume the errors will be caught
> elsewhere.
> except Http404:
> return response
> except:
> if settings.DEBUG:
> raise
> return response
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---