<commit_before>#TODO AUTOMATICALLY TEST SYSTEM LIMITS

#TODO: figure out limits to branch count

#TODO: Ranking algorithm

import json
import threading
import base
from simpleauth import SimpleAuthHandler
import datetime

import secrets
import logging
from models import Tree
from models import Branch
from controllers import BaseController
from google.appengine.api import users


class RequestHandler(base.BaseRequestHandler):
    def username(self):
        return self.request.cookies.get('username')

class MainHandler(RequestHandler):
    
    def get(self):
        
        trees = Tree.main_trees()
        branchdatas = Branch.get_first_branchs(trees)
        logging.info(trees)
        template_values = {
            'trees': trees,
            'branchdatas': branchdatas,
            'username': self.username()
        }
        
        self.render('main.html', template_values)

class TreeFormHandler(RequestHandler):
    
    def get(self):
        self.render('tree_form.html', {})
        
class TreeHandler(RequestHandler):
    def get(self, tree_name):
        
        self.render('tree.html',{})
        
class AboutHandler(RequestHandler):

    def get(self):
        self.render('about.html',{})

class UserHandler(RequestHandler):
    
    def get(self,username):
        self.render('user.html',{})
                            
class AuthHandler(RequestHandler, SimpleAuthHandler):
    """Authentication handler for OAuth 2.0, 1.0(a) and OpenID."""

    # Enable optional OAuth 2.0 CSRF guard
    OAUTH2_CSRF_STATE = True
    
    USER_ATTRS = {
        'facebook' : {
            'name'   : 'name',
            'link'   : 'link',
            '_attrs' : [
                ('id' , lambda id: ('avatar_url', 'http://graph.facebook.com/{0}/picture?type=large'.format(id)))
            ]
        },<commit_msg>Allow for tree_name parameter to edit method Generally what I'd like to do at some point is create the pages as static assets in the make process, and remove these handlers entirely.<commit_after>#TODO AUTOMATICALLY TEST SYSTEM LIMITS

#TODO: figure out limits to branch count

#TODO: Ranking algorithm

import json
import threading
import base
from simpleauth import SimpleAuthHandler
import datetime

import secrets
import logging
from models import Tree
from models import Branch
from controllers import BaseController
from google.appengine.api import users


class RequestHandler(base.BaseRequestHandler):
    def username(self):
        return self.request.cookies.get('username')

class MainHandler(RequestHandler):
    
    def get(self):
        
        trees = Tree.main_trees()
        branchdatas = Branch.get_first_branchs(trees)
        logging.info(trees)
        template_values = {
            'trees': trees,
            'branchdatas': branchdatas,
            'username': self.username()
        }
        
        self.render('main.html', template_values)

class TreeFormHandler(RequestHandler):
    
    def get(self,tree_name=None):
        self.render('tree_form.html', {})
        
class TreeHandler(RequestHandler):
    def get(self, tree_name):
        
        self.render('tree.html',{})
        
class AboutHandler(RequestHandler):

    def get(self):
        self.render('about.html',{})

class UserHandler(RequestHandler):
    
    def get(self,username):
        self.render('user.html',{})
                            
class AuthHandler(RequestHandler, SimpleAuthHandler):
    """Authentication handler for OAuth 2.0, 1.0(a) and OpenID."""

    # Enable optional OAuth 2.0 CSRF guard
    OAUTH2_CSRF_STATE = True
    
    USER_ATTRS = {
        'facebook' : {
            'name'   : 'name',
            'link'   : 'link',
            '_attrs' : [
                ('id' , lambda id: ('avatar_url', 'http://graph.facebook.com/{0}/picture?type=large'.format(id)))
            ]
        },
{'fraction_non_alphanumeric': 0.1041017653167186, 'fraction_numerical': 0.004153686396677051, 'mean_word_length': 2.5577100646352724, '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': '5722012', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1059, 'n_words': 277}