Mercurial > public > sg101
view gpp/core/middleware.py @ 220:71fd8454688b
For #51, added weblinks to search. Decided against using the search index to store prerendered results. My fear is this could get too unweildy once we add forums.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 06 Jun 2010 20:06:15 +0000 |
parents | 8c1832b9d815 |
children | 423c39ee44e0 |
line wrap: on
line source
"""Common middleware for the entire project.""" from django.contrib.auth import logout class InactiveUserMiddleware(object): """ This middleware ensures users with is_active set to False get their session destroyed and are treated as logged out. This middleware should come after the 'django.contrib.auth.middleware. AuthenticationMiddleware' in settings.py. Idea taken from: http://djangosnippets.org/snippets/1105/ """ def process_request(self, request): if request.user.is_authenticated() and not request.user.is_active: logout(request)