summaryrefslogtreecommitdiffstats
path: root/middleware/anon_user.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2009-11-17 22:14:15 -0500
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2009-11-17 22:14:15 -0500
commit46e48e400f30bde76a9b21db78f9b727149a3e24 (patch)
treeb1782037766b019b6682c5265f93fe0745c36110 /middleware/anon_user.py
parent56bc6d41fa35c8fb06eff8270a986ff5d3f3dc7c (diff)
downloadaskbot-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.py8
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)