<commit_before># -*- coding: utf-8 -*-

import os
import time
import pickle
import logging
import datetime

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext

from django.http import HttpResponseForbidden
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render

logger = logging.getLogger(__name__)

from django.contrib.auth.models import User
from userprofile.models import Profile as userprofile
from userprofile.views import _log_user_activity


def invoices(request):

	print '-- invoices:'

	if not request.user.is_authenticated():
		return HttpResponseRedirect("/")

	user = request.user
	profile = userprofile.objects.get(user=request.user)
	secret = profile.secret

	print request.user

	_log_user_activity(profile,"click","/invoices/","invoices")
	

	return render_to_response('invoices.html', {'user':user,'profile':profile,}, context_instance=RequestContext(request))<commit_msg>introduced ip logging onto invoices as well<commit_after># -*- coding: utf-8 -*-

import os
import time
import pickle
import logging
import datetime

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext

from django.http import HttpResponseForbidden
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render

logger = logging.getLogger(__name__)

from django.contrib.auth.models import User
from userprofile.models import Profile as userprofile
from userprofile.views import _log_user_activity


def invoices(request):

	print '-- invoices:'

	if not request.user.is_authenticated():
		return HttpResponseRedirect("/")

	user = request.user
	profile = userprofile.objects.get(user=request.user)
	secret = profile.secret

	print request.user

	ip = request.META['REMOTE_ADDR']
	_log_user_activity(profile,"click","/invoices/","invoices",ip=ip)
	

	return render_to_response('invoices.html', {'user':user,'profile':profile,}, context_instance=RequestContext(request))
{'fraction_non_alphanumeric': 0.09056603773584905, 'fraction_numerical': 0.0009433962264150943, 'mean_word_length': 6.313793103448276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7511636', 'n_tokens_mistral': 609, 'n_tokens_neox': 578, 'n_words': 161}