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

from flask import render_template, redirect, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from flask.ext.babel import gettext
from wtforms.validators import NumberRange
from app import app, babel, db, lm
import json
from datetime import datetime

from .forms import *
from config import LANGUAGES, SERVER_IP, BABEL_DEFAULT_LOCALE, WEEKDAYS
from .system import *
from .data import *

@babel.localeselector
def get_locale():
    #return request.accept_languages.best_match(LANGUAGES.keys())
    return request.accept_languages.best_match(['pl'])

@app.before_request
def before_request():
    #g.user = current_user
    g.user = None 

@lm.user_loader
def load_user():
    return User()

@app.route('/login', methods=['GET', 'POST'])
def login():
    g.user = current_user
    form = LoginForm()
#    if form.validate_on_submit():
#        flash('Login requested for OpenID="%s", remember_me=%s' %
#              (form.openid.data, str(form.remember_me.data)))
#        return redirect('/dashboard')
    return render_template('login.html',
                           active='login',
                           title=gettext('Log in'),
                           form=form)

@app.route('/')
@app.route('/index')
@app.route('/dashboard')
def dashboard():
    user='admin'
    return render_template("content/dashboard.html",
                           active='dashboard',<commit_msg>added logout to views<commit_after># -*- coding: UTF-8 -*-

from flask import render_template, redirect, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from flask.ext.babel import gettext
from wtforms.validators import NumberRange
from app import app, babel, db, lm
import json
from datetime import datetime

from .forms import *
from config import LANGUAGES, SERVER_IP, BABEL_DEFAULT_LOCALE, WEEKDAYS
from .system import *
from .data import *

@babel.localeselector
def get_locale():
    #return request.accept_languages.best_match(LANGUAGES.keys())
    return request.accept_languages.best_match(['pl'])

@app.before_request
def before_request():
    #g.user = current_user
    g.user = None 

@lm.user_loader
def load_user():
    return User()

@app.route('/login', methods=['GET', 'POST'])
def login():
    g.user = current_user
    form = LoginForm()
#    if form.validate_on_submit():
#        flash('Login requested for OpenID="%s", remember_me=%s' %
#              (form.openid.data, str(form.remember_me.data)))
#        return redirect('/dashboard')
    return render_template('login.html',
                           active='login',
                           title=gettext('Log in'),
                           form=form)

@login_required
@app.route("/logout")
def logout():
    logout_user()
    return redirect('/')

@app.route('/')
@app.route('/index')
@app.route('/dashboard')
def dashboard():
    user='admin'
    return render_template("content/dashboard.html",
                           active='dashboard',
{'fraction_non_alphanumeric': 0.12763157894736843, 'fraction_numerical': 0.0006578947368421052, 'mean_word_length': 3.2294853963838666, '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': '1295292', 'n_tokens_mistral': 928, 'n_tokens_neox': 909, 'n_words': 225}