]> git.openstreetmap.org Git - osqa.git/blob - forum/middleware/extended_user.py
Directory 'osqa' created by PyCharm
[osqa.git] / forum / middleware / extended_user.py
1 from django.contrib.auth.middleware import AuthenticationMiddleware\r
2 from forum.models.user import AnonymousUser\r
3 \r
4 class ExtendedUser(AuthenticationMiddleware):    \r
5     def process_request(self, request):\r
6         super(ExtendedUser, self).process_request(request)\r
7         if request.user.is_authenticated():\r
8             try:\r
9                 request.user = request.user.user\r
10                 return None\r
11             except:\r
12                 pass\r
13 \r
14         request.user = AnonymousUser()\r
15         return None