<commit_before>"""Writing your own context processors

A context processor is a Python function that takes one argument, an
HttpRequest object, and returns a dictionary that gets added to the template
context. Each context processor must return a dictionary.

Custom context processors can live anywhere in the code base. All Django cares
about is that your custom context processors are pointed-to by the
TEMPLATE_CONTEXT_PROCESSORS setting."""

from ielex.settings import VERSION
from ielex import local_settings
from ielex.lexicon.models import *
from ielex.extensional_semantics.models import *

# config = None # XXX what's this for?

def configuration(request):
    """Various things stored in local_settings.py"""
    return {"version":VERSION,
            "current_url":request.get_full_path(),
            "project_long_name":local_settings.project_long_name,
            "project_short_name":local_settings.project_short_name,
            "project_description":local_settings.project_description,
            "acknowledgements":local_settings.acknowledgements,
            "semantic_domains":local_settings.semantic_domains,
            "structural_features":local_settings.structural_features
            }

def navigation(request):
    return {"current_wordlist_name":
                    request.session.get("current_wordlist_name", "CWN"),
            "current_language_list_name":
                    request.session.get("current_language_list_name", "CLLN"),
            }<commit_msg>set default session variable values in context processor<commit_after>"""Writing your own context processors

A context processor is a Python function that takes one argument, an
HttpRequest object, and returns a dictionary that gets added to the template
context. Each context processor must return a dictionary.

Custom context processors can live anywhere in the code base. All Django cares
about is that your custom context processors are pointed-to by the
TEMPLATE_CONTEXT_PROCESSORS setting."""

from ielex.settings import VERSION
from ielex import local_settings
from ielex.lexicon.models import *
from ielex.extensional_semantics.models import *

def configuration(request):
    """Various things stored in local_settings.py"""
    return {"version":VERSION,
            "current_url":request.get_full_path(),
            "project_long_name":local_settings.project_long_name,
            "project_short_name":local_settings.project_short_name,
            "project_description":local_settings.project_description,
            "acknowledgements":local_settings.acknowledgements,
            "semantic_domains":local_settings.semantic_domains,
            "structural_features":local_settings.structural_features
            }

def navigation(request):
    return {"current_wordlist_name":
                    request.session.get("current_wordlist_name",
                    MeaningList.DEFAULT),
            "current_language_list_name":
                    request.session.get("current_language_list_name",
                    LanguageList.DEFAULT),
            }
{'fraction_non_alphanumeric': 0.07000976880494952, 'fraction_numerical': 0.0, 'mean_word_length': 3.5988023952095807, 'pattern_counts': {'":': 20, '<': 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': '3682889', 'n_tokens_mistral': 778, 'n_tokens_neox': 739, 'n_words': 217}