<commit_before>from django.template.response import TemplateResponse

from ..products.models import Product
from ..static import testcyclestatus
from ..users.decorators import login_required

from .models import TestCycleList



@login_required
def cycles(request, product_id):
    product = Product.get("products/%s" % product_id, auth=request.auth)

    # @@@ should be auth=request.auth - API permissions broken here?
    from ..core.api import admin
    cycles = TestCycleList.get(auth=admin).filter(
        productId=product_id, testCycleStatusId=testcyclestatus.ACTIVE)

    return TemplateResponse(
        request, "test/cycles.html", {"product": product, "cycles": cycles})
<commit_msg>Use correct auth in cycles view, now that API permissions are fixed.<commit_after>from django.template.response import TemplateResponse

from ..products.models import Product
from ..static import testcyclestatus
from ..users.decorators import login_required

from .models import TestCycleList



@login_required
def cycles(request, product_id):
    product = Product.get("products/%s" % product_id, auth=request.auth)

    cycles = TestCycleList.get(auth=request.auth).filter(
        productId=product_id, testCycleStatusId=testcyclestatus.ACTIVE)

    return TemplateResponse(
        request, "test/cycles.html", {"product": product, "cycles": cycles})

{'fraction_non_alphanumeric': 0.09911242603550297, 'fraction_numerical': 0.0, 'mean_word_length': 4.757446808510639, 'pattern_counts': {'":': 4, '<': 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': '5427063', 'n_tokens_mistral': 378, 'n_tokens_neox': 367, 'n_words': 102}