diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2009-11-17 22:14:15 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2009-11-17 22:14:15 -0500 |
commit | 46e48e400f30bde76a9b21db78f9b727149a3e24 (patch) | |
tree | b1782037766b019b6682c5265f93fe0745c36110 /middleware/anon_user.py | |
parent | 56bc6d41fa35c8fb06eff8270a986ff5d3f3dc7c (diff) | |
download | askbot-46e48e400f30bde76a9b21db78f9b727149a3e24.tar.gz askbot-46e48e400f30bde76a9b21db78f9b727149a3e24.tar.bz2 askbot-46e48e400f30bde76a9b21db78f9b727149a3e24.zip |
full text search with Sphinx, added session-based greeting message for the first time visitor
Diffstat (limited to 'middleware/anon_user.py')
-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) |