]> git.openstreetmap.org Git - osqa.git/blob - forum/context.py
Makes hitting a question url using an id that is not a question raise a 404.
[osqa.git] / forum / context.py
1 from forum import settings
2
3 def application_settings(context):
4     return {'settings': settings}
5
6 def auth_processor(request):
7     if hasattr(request, 'user'):
8         user = request.user
9         if user.is_authenticated():
10             messages = user.message_set.all()
11         else:
12             messages = None
13     else:
14         from django.contrib.auth.models import AnonymousUser
15         user = AnonymousUser()
16         messages = None
17
18     from django.core.context_processors import PermWrapper
19     return {
20         'user': user,
21         'messages': messages,
22         'perms': PermWrapper(user),
23     }