summaryrefslogtreecommitdiffstats
path: root/middleware
diff options
context:
space:
mode:
authorAdolfo Fitoria <fitoria@fitoria-laptop.(none)>2009-12-15 16:57:37 -0600
committerAdolfo Fitoria <fitoria@fitoria-laptop.(none)>2009-12-15 16:57:37 -0600
commit9d1fb9890b97beb55461ca34f9757bc685461130 (patch)
tree1f8f0552ba6f4ca092aaa5a5347f0ad07433f1de /middleware
parentebb0f636ae8f7db4e7a2e7470e449af3d96b15c0 (diff)
parent82d35490db90878f013523c4d1a5ec3af2df8b23 (diff)
downloadaskbot-9d1fb9890b97beb55461ca34f9757bc685461130.tar.gz
askbot-9d1fb9890b97beb55461ca34f9757bc685461130.tar.bz2
askbot-9d1fb9890b97beb55461ca34f9757bc685461130.zip
Merge branch 'master' of git://github.com/evgenyfadeev/CNPROG into evgenyfadeev/master
Conflicts: INSTALL LICENSE TODO cnprog.wsgi context.py development.log forum/feed.py forum/forms.py forum/management/commands/send_email_alerts.py forum/managers.py forum/models.py forum/templatetags/extra_filters.py forum/templatetags/extra_tags.py forum/urls.py forum/views.py locale/en/LC_MESSAGES/django.mo locale/en/LC_MESSAGES/django.po middleware/__init__.py middleware/anon_user.py settings.py settings_local.py.dist templates/about.html templates/authopenid/complete.html templates/authopenid/external_legacy_login_info.html templates/base.html templates/base_content.html templates/content/js/com.cnprog.admin.js templates/content/js/com.cnprog.i18n.js templates/content/js/com.cnprog.post.js templates/content/js/com.cnprog.utils.js templates/content/js/wmd/wmd.js templates/content/style/style.css templates/question.html templates/questions.html templates/unanswered.html templates/user_email_subscriptions.html templates/user_reputation.html templates/user_stats.html templates/user_votes.html
Diffstat (limited to 'middleware')
-rw-r--r--middleware/__init__.py~HEAD0
-rw-r--r--middleware/anon_user.py8
2 files changed, 8 insertions, 0 deletions
diff --git a/middleware/__init__.py~HEAD b/middleware/__init__.py~HEAD
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/middleware/__init__.py~HEAD
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)