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 django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to