<commit_before>from app import app
from flask.ext.appbuilder.security.models import is_menu_public, is_item_public
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask import g, request
from flask.ext.login import current_user


def app_template_filter(filter_name=''):
    """
        Use this decorator to expose views in your view classes.
    """
    def wrap(f):
        if not hasattr(f, '_filter'):
            f._filter = filter_name
        return f
    return wrap


class TemplateFilters(object):
    
    def __init__(self, app):
        for attr_name in dir(self):
            if hasattr(getattr(self, attr_name),'_filter'):
                attr = getattr(self, attr_name)
                app.jinja_env.filters[attr._filter] = attr

    @app_template_filter('link_order')
    def link_order_filter(s):

        if (request.args.get('order_column') == s):
            lststr = request.path.split('?')
            if (request.args.get('order_direction') == 'asc'):
                return lststr[0] + '?order_column=' + s + '&order_direction=desc'
            else:
                return  request.path + '?order_column=' + s + '&order_direction=asc'
        else:
            return  request.path + '?order_column=' + s + '&order_direction=asc'



@app.template_filter('get_link_next')
def get_link_next_filter(s):
    print "NEXT = ", request.args.get('next')
    return request.args.get('next')<commit_msg>Update filters.py<commit_after>from app import app
from flask.ext.appbuilder.security.models import is_menu_public, is_item_public
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask import g, request
from flask.ext.login import current_user


def app_template_filter(filter_name=''):
    """
        Use this decorator to expose views in your view classes.
    """
    def wrap(f):
        if not hasattr(f, '_filter'):
            f._filter = filter_name
        return f
    return wrap


class TemplateFilters(object):
    
    def __init__(self, app):
        for attr_name in dir(self):
            if hasattr(getattr(self, attr_name),'_filter'):
                attr = getattr(self, attr_name)
                app.jinja_env.filters[attr._filter] = attr

    @app_template_filter('link_order')
    def link_order_filter(self, s):

        if (request.args.get('order_column') == s):
            lststr = request.path.split('?')
            if (request.args.get('order_direction') == 'asc'):
                return lststr[0] + '?order_column=' + s + '&order_direction=desc'
            else:
                return  request.path + '?order_column=' + s + '&order_direction=asc'
        else:
            return  request.path + '?order_column=' + s + '&order_direction=asc'



@app.template_filter('get_link_next')
def get_link_next_filter(s):
    print "NEXT = ", request.args.get('next')
    return request.args.get('next')
{'fraction_non_alphanumeric': 0.11997226074895978, 'fraction_numerical': 0.0006934812760055479, 'mean_word_length': 2.766318537859008, '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': '3072584', 'n_tokens_mistral': 902, 'n_tokens_neox': 869, 'n_words': 199}