<commit_before><commit_msg>adding common function file<commit_after>from django.conf import settings
from django.contrib.sites.models import Site

from site_seo.models import SiteUrl404


def add_404_url(request):
    try:
        siteurl404 = SiteUrl404.objects.get(url=request.path_info)
        siteurl404.hit_cnt += 1
        siteurl404.save()

    except SiteUrl404.DoesNotExist:
        site = Site.objects.get_current()
        siteurl404 = SiteUrl404()
        siteurl404.url = request.path_info
        siteurl404.site = site
        siteurl404.hit_cnt = 1
        siteurl404.save()

    return True
{'fraction_non_alphanumeric': 0.07894736842105263, 'fraction_numerical': 0.06743421052631579, 'mean_word_length': 3.0065789473684212, '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': '3992866', 'n_tokens_mistral': 216, 'n_tokens_neox': 183, 'n_words': 38}