diff options
Diffstat (limited to 'middleware')
-rw-r--r-- | middleware/anon_user.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/middleware/anon_user.py b/middleware/anon_user.py index c7ff05bc..8422d89b 100644 --- a/middleware/anon_user.py +++ b/middleware/anon_user.py @@ -1,6 +1,8 @@ from django.http import HttpResponseRedirect from django_authopenid.util import get_next_url +from django.utils.translation import ugettext as _ from user_messages import create_message, get_and_delete_messages +import settings import logging class AnonymousMessageManager(object): @@ -24,3 +26,9 @@ class ConnectToSessionMessagesMiddleware(object): request.user.__deepcopy__ = dummy_deepcopy #plug on deepcopy which may be called by django db "driver" request.user.message_set = AnonymousMessageManager(request) #here request is linked to anon user request.user.get_and_delete_messages = request.user.message_set.get_and_delete + + #also set the first greeting one time per session only + if 'greeting_set' not in request.session: + request.session['greeting_set'] = True + msg = _('first time greeting with %(url)s') % {'url':settings.GREETING_URL} + request.user.message_set.create(message=msg) |