<commit_before>from __future__ import absolute_import

from django.http import HttpResponse
from django.template import loader, Context

from sentry.web.frontend.base import BaseView, OrganizationView


class ReactMixin(object):
    def handle_react(self, request):
        context = Context({'request': request})
        template = loader.render_to_string('sentry/bases/react.html', context)

        response = HttpResponse(template)
        response['Content-Type'] = 'text/html'

        return response


# TODO(dcramer): once we implement basic auth hooks in React we can make this<commit_msg>Make sure all React pages have a CSRF token in session<commit_after>from __future__ import absolute_import

from django.core.context_processors import csrf
from django.http import HttpResponse
from django.template import loader, Context

from sentry.web.frontend.base import BaseView, OrganizationView


class ReactMixin(object):
    def handle_react(self, request):
        context = Context({'request': request})
        context.update(csrf(request))

        template = loader.render_to_string('sentry/bases/react.html', context)

        response = HttpResponse(template)
        response['Content-Type'] = 'text/html'

        return response


# TODO(dcramer): once we implement basic auth hooks in React we can make this
{'fraction_non_alphanumeric': 0.08220211161387632, 'fraction_numerical': 0.0, 'mean_word_length': 4.1434108527131785, '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': '7043155', 'n_tokens_mistral': 356, 'n_tokens_neox': 345, 'n_words': 110}