<commit_before># -*- coding: UTF-8 -*-
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core import urlresolvers
from django.template.defaultfilters import timesince
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from horizon import tables

class BaseFilterAction(tables.FilterAction):
    """filter action for search in all available columns

    .. attribute:: custom_field

        Custom field for search. Default is all fields.

    """
    needs_preloading = True
    
    custom_field = None #not implemented

    def filter(self, table, data, filter_string):
        q = filter_string.lower()

        def comp(obj):
            if isinstance(obj, dict):
                for key, value in obj.iteritems():
                    if q in str(obj.get(key, "")).lower():
                        return True
            if isinstance(obj, object):
                try:
                    for prop in obj._meta.fields:
                        name = prop.name
                        if q in str(obj.__dict__[name]):
                            return True
                except Exception, e:
                    #swallowed exception
                    pass
            return False
        try:
            data = table.get_paginator_data() #all data for table
        except AttributeError:
            pass
        return filter(comp, data)

class FilterAction(BaseFilterAction):
    pass
<commit_msg>temporary fix table pagination<commit_after># -*- coding: UTF-8 -*-
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core import urlresolvers
from django.template.defaultfilters import timesince
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from horizon import tables

class BaseFilterAction(tables.FilterAction):
    """filter action for search in all available columns

    .. attribute:: custom_field

        Custom field for search. Default is all fields.

    """
    needs_preloading = False
    
    custom_field = None #not implemented

    def filter(self, table, data, filter_string):
        q = filter_string.lower()

        def comp(obj):
            if isinstance(obj, dict):
                for key, value in obj.iteritems():
                    if q in str(obj.get(key, "")).lower():
                        return True
            if isinstance(obj, object):
                try:
                    for prop in obj._meta.fields:
                        name = prop.name
                        if q in str(obj.__dict__[name]):
                            return True
                except Exception, e:
                    #swallowed exception
                    pass
            return False
        return filter(comp, table.get_paginator_data())

class FilterAction(BaseFilterAction):
    pass

{'fraction_non_alphanumeric': 0.07112561174551386, 'fraction_numerical': 0.0006525285481239804, 'mean_word_length': 1.9395973154362416, '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': '4990624', 'n_tokens_mistral': 760, 'n_tokens_neox': 721, 'n_words': 249}