<commit_before>import json
import re
from decimal import Decimal
from easy_pdf.rendering import render_to_pdf_response
from django.shortcuts import render_to_response  # , get_object_or_404
from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.views import generic
from django.views.decorators.csrf import csrf_protect
from django.db import transaction
from django.db.models import Q

from django.contrib.auth.models import User
from models import Item, Category, BillItem, Bill
from . import dbmanager as dbmng
from forms import ReportForm, SearchForm

from django.template import RequestContext
import logging


def index(request):
    """Testing view. If the request has an authenticated user token, the view
    returns a rendered page with all enabled items in the database and the
    username of the currently logged user. If the user is not authenticated it
    redirects to the login page."""
    logger = logging.getLogger(__name__)
    if request.user.is_authenticated():
        logger.info(
                "User " + request.user.get_username() + " authenticated fine"
                )
        display_items = Item.objects.filter(enabled=True)
        server = User.objects.get(pk=request.user.id)
        return render_to_response('webpos/index.html', {'items': display_items,
                                                        'server': server})<commit_msg>moved logger declaration at module level<commit_after>import json
import re
from decimal import Decimal
from easy_pdf.rendering import render_to_pdf_response
from django.shortcuts import render_to_response  # , get_object_or_404
from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.views import generic
from django.views.decorators.csrf import csrf_protect
from django.db import transaction
from django.db.models import Q

from django.contrib.auth.models import User
from models import Item, Category, BillItem, Bill
from . import dbmanager as dbmng
from forms import ReportForm, SearchForm

from django.template import RequestContext
import logging

logger = logging.getLogger(__name__)

def index(request):
    """Testing view. If the request has an authenticated user token, the view
    returns a rendered page with all enabled items in the database and the
    username of the currently logged user. If the user is not authenticated it
    redirects to the login page."""
    if request.user.is_authenticated():
        logger.info(
                "User " + request.user.get_username() + " authenticated fine"
                )
        display_items = Item.objects.filter(enabled=True)
        server = User.objects.get(pk=request.user.id)
        return render_to_response('webpos/index.html', {'items': display_items,
                                                        'server': server})
{'fraction_non_alphanumeric': 0.06345957011258956, 'fraction_numerical': 0.0020470829068577278, 'mean_word_length': 3.4695121951219514, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6930031', 'n_tokens_mistral': 746, 'n_tokens_neox': 726, 'n_words': 272}