summaryrefslogtreecommitdiffstats
path: root/forum/middleware/view_log.py
diff options
context:
space:
mode:
Diffstat (limited to 'forum/middleware/view_log.py')
-rw-r--r--forum/middleware/view_log.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/forum/middleware/view_log.py b/forum/middleware/view_log.py
index 6f59568a..213292fe 100644
--- a/forum/middleware/view_log.py
+++ b/forum/middleware/view_log.py
@@ -1,8 +1,16 @@
import logging
from django.conf import settings
from forum.views.readers import questions as questions_view
-from forum.views.commands import vote as vote_view
-from django.views.static import serve as django_serve_view
+from forum.views.commands import vote
+from django.views.static import serve
+from forum.views.writers import delete_comment, question_comments, answer_comments
+from forum.views.readers import question, question_revisions, answer_revisions
+
+#todo: the list is getting bigger and bigger - maybe there is a better way to
+#trigger reset of sarch state?
+IGNORED_VIEWS = (serve, vote, delete_comment,
+ question_comments, answer_comments,
+ question, question_revisions, answer_revisions)
class ViewLog(object):
"""must be modified only in this middlware
@@ -36,17 +44,21 @@ class ViewLogMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
if view_func == questions_view:
view_str = 'questions'
- elif view_func in (django_serve_view, vote_view):
+ elif view_func in IGNORED_VIEWS:
return
- elif settings.DEBUG == True:
+ else:
+ view_str = view_func.__name__
+ if view_str == 'wrap':
+ print str(view_func.__module__)# == 'forum.utils.decorators':
+ return
+
+ if settings.DEBUG == True:
#todo: dependency!
- from debug_toolbar.views import debug_media_view
+ from debug_toolbar.views import debug_media as debug_media_view
if view_func == debug_media_view:
return
else:
view_str = view_func.__name__
- else:
- view_str = view_func.__name__
if request.user.is_authenticated():
user_name = request.user.username