<commit_before># -*- coding: utf-8 -*-

from django.template import RequestContext, loader
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden  

# A custom Http403 exception
# from http://theglenbot.com/creating-a-custom-http403-exception-in-django/

class Http403(Exception):    
    pass  

def render_to_403(*args, **kwargs):     
    if not isinstance(args,list):         
        args = []         
        args.append('403.html')              

    httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}          
    response = HttpResponseForbidden(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)              

    return response  

class Http403Middleware(object):     
    def process_exception(self,request,exception):         <commit_msg>common: Update mimetype to content_type here, too.<commit_after># -*- coding: utf-8 -*-

from django.template import RequestContext, loader
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden  

# A custom Http403 exception
# from http://theglenbot.com/creating-a-custom-http403-exception-in-django/

class Http403(Exception):    
    pass  

def render_to_403(*args, **kwargs):     
    if not isinstance(args,list):         
        args = []         
        args.append('403.html')              

    httpresponse_kwargs = {'content_type': kwargs.pop('content_type', None)}          
    response = HttpResponseForbidden(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)              

    return response  

class Http403Middleware(object):     
    def process_exception(self,request,exception):         
{'fraction_non_alphanumeric': 0.10153148043108338, 'fraction_numerical': 0.021554169030062395, 'mean_word_length': 3.0273972602739727, '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': '4066972', 'n_tokens_mistral': 503, 'n_tokens_neox': 479, 'n_words': 108}