<commit_before># Copyright (c) 2008 Participatory Culture Foundation
# See LICENSE for details.

from django.conf import settings
from django.utils.translation import gettext as _

from channelguide import util, cache
from channelguide.guide.auth import admin_required
from channelguide.guide.models import Language

@cache.aggresively_cache
def index(request):
    query = Language.query().load('channel_count').order_by('name')
    return util.render_to_response(request, 'group-list.html', {
        'group_name': _('Shows by Language'),
        'groups': query.execute(request.connection),
    })

@admin_required
def moderate(request):
    query = Language.query().order_by('name')
    return util.render_to_response(request, 'edit-categories.html', {
        'header': _('Edit Languages'),
        'new_label': _('New Language'),
        'action_url_prefix': settings.BASE_URL + "languages",
        'categories': query.execute(request.connection),
    })
<commit_msg>cache the Language index query for an hour<commit_after># Copyright (c) 2008 Participatory Culture Foundation
# See LICENSE for details.

from django.conf import settings
from django.utils.translation import gettext as _

from channelguide import util, cache
from channelguide.guide.auth import admin_required
from channelguide.guide.models import Language

@cache.aggresively_cache
def index(request):
    query = Language.query().load('channel_count').order_by('name')
    query.cacheable = cache.client
    query.cacheable_time = 3600
    return util.render_to_response(request, 'group-list.html', {
        'group_name': _('Shows by Language'),
        'groups': query.execute(request.connection),
    })

@admin_required
def moderate(request):
    query = Language.query().order_by('name')
    return util.render_to_response(request, 'edit-categories.html', {
        'header': _('Edit Languages'),
        'new_label': _('New Language'),
        'action_url_prefix': settings.BASE_URL + "languages",
        'categories': query.execute(request.connection),
    })

{'fraction_non_alphanumeric': 0.11790606653620352, 'fraction_numerical': 0.005870841487279843, 'mean_word_length': 4.424403183023872, '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': '1993653', 'n_tokens_mistral': 588, 'n_tokens_neox': 566, 'n_words': 143}