Skip to content
Snippets Groups Projects
Commit 6d5433bd authored by Piotr Mitros's avatar Piotr Mitros
Browse files

Tracking system enhanced

parent 4405bef7
No related merge requests found
......@@ -85,6 +85,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'track.middleware.TrackMiddleware',
'djangomako.middleware.MakoMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
)
......
import views, json
class TrackMiddleware:
def process_request (self, request):
try:
# We're already logging events
if request.META['PATH_INFO'] == '/event':
return
event = { 'GET' : dict(request.GET),
'POST' : dict(request.POST)}
# TODO: Confirm no large file uploads
event = json.dumps(event)
event = event[:512]
views.server_track(request, request.META['PATH_INFO'], event)
except:
pass
......@@ -55,7 +55,6 @@ def server_track(request, event_type, event, page=None):
event = {
"username" : request.user.username,
"ip" : request.META['REMOTE_ADDR'],
"ip" : request.META['REMOTE_ADDR'],
"event_source" : "server",
"event_type" : event_type,
"event" : event,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment