summaryrefslogtreecommitdiffstats
path: root/askbot/middleware
diff options
context:
space:
mode:
authorTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2012-01-11 23:06:30 +0100
committerTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2012-01-11 23:11:23 +0100
commit9ba647898a7f181848d54d1af08ef2a8b211eefc (patch)
tree737574219f240ffa4c5ea53d88f02a3d756f1595 /askbot/middleware
parent2f399da2fd6d353804c1c92c47c5baea552c9817 (diff)
downloadaskbot-9ba647898a7f181848d54d1af08ef2a8b211eefc.tar.gz
askbot-9ba647898a7f181848d54d1af08ef2a8b211eefc.tar.bz2
askbot-9ba647898a7f181848d54d1af08ef2a8b211eefc.zip
Removed some unused code related directly or indirectly to SearchState
Diffstat (limited to 'askbot/middleware')
-rw-r--r--askbot/middleware/view_log.py57
1 files changed, 5 insertions, 52 deletions
diff --git a/askbot/middleware/view_log.py b/askbot/middleware/view_log.py
index 0880ae1b..52127148 100644
--- a/askbot/middleware/view_log.py
+++ b/askbot/middleware/view_log.py
@@ -1,33 +1,16 @@
-"""This module records the site visits by the authenticaded
-users and heps maintain the state of the search (for all visitors).
+"""
+This module records the site visits by the authenticated users
Included here is the ViewLogMiddleware
"""
-import logging
import datetime
-from django.conf import settings
-from django.views.static import serve
-from django.views.i18n import javascript_catalog
from askbot.models import signals
-from askbot.views.readers import questions as questions_view
-from askbot.views.commands import vote, get_tag_list
-from askbot.views.writers import delete_comment, post_comments, retag_question
-from askbot.views.readers import revisions, get_question_body
-from askbot.views.meta import media
-from askbot.search.state_manager import ViewLog
-
-#todo: the list is getting bigger and bigger - maybe there is a better way to
-#trigger reset of sarch state?
-IGNORED_VIEWS = (
- serve, vote, media, delete_comment, post_comments,
- retag_question, revisions, javascript_catalog,
- get_tag_list, get_question_body
-)
class ViewLogMiddleware(object):
- """ViewLogMiddleware does two things: tracks visits of pages for the
- stateful site search and sends the site_visited signal
+ """
+ ViewLogMiddleware sends the site_visited signal
+
"""
def process_view(self, request, view_func, view_args, view_kwargs):
#send the site_visited signal for the authenticated users
@@ -36,33 +19,3 @@ class ViewLogMiddleware(object):
user = request.user,
timestamp = datetime.datetime.now()
)
-
- #remaining stuff is for the search state
- if view_func == questions_view:
- view_str = 'questions'
- elif view_func in IGNORED_VIEWS:
- return
- else:
- view_str = view_func.__name__
- if view_str == 'wrap':
- return
-
- if settings.DEBUG == True:
- #todo: dependency!
- try:
- from debug_toolbar.views import debug_media as debug_media_view
- if view_func == debug_media_view:
- return
- except ImportError:
- pass
-
- logging.debug('user %s, view %s' % (request.user.username, view_str))
- logging.debug('next url is %s' % request.REQUEST.get('next','nothing'))
-
- if 'view_log' in request.session:
- view_log = request.session['view_log']
- else:
- view_log = ViewLog()
-
- view_log.set_current(view_str)
- request.session['view_log'] = view_log