o ah @spdZddlZddlmZddlmZddlmZmZddZ dd Z d d Z d d Z ddZ ddZddZdS)aR A set of request processors that return dictionaries to be merged into a template context. Each function takes the request object as its only parameter and returns a dictionary to add to the context. These are referenced from the 'context_processors' option of the configuration of a DjangoTemplates backend and used by RequestContext. N)settings get_token)SimpleLazyObjectlazycsfdd}dt|iS)z Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if it has not been provided by either a view decorator or the middleware cst}|dur dS|S)N NOTPROVIDEDr)tokenrequestD/usr/lib/python3/dist-packages/django/template/context_processors.py_get_valszcsrf.._get_val csrf_token)r)r r r r r csrfs  rcsJi}tjr#|jdtjvr#d|d<ddlmtfddt|d<|S) z9 Return context variables helpful for debugging. REMOTE_ADDRTdebugr connectionscsttjfddDS)Nc3s|]}|jVqdS)N)queries).0xrr r /sz*debug....)list itertoolschain from_iterabler rr r /szdebug.. sql_queries) rDEBUGMETAget INTERNAL_IPS django.dbrrr)r context_extrasr rr r#s  rcCs"ddlm}tj||dS)Nr) translation) LANGUAGES LANGUAGE_CODE LANGUAGE_BIDI) django.utilsr$rr% get_languageget_language_bidi)r r$r r r i18n5s r+cCsddlm}d|iS)Nr)timezone TIME_ZONE)r(r,get_current_timezone_name)r r,r r r tz>s  r/cC dtjiS)z> Add static-related context variables to the context. STATIC_URL)rr1r r r r staticC r2cCr0)z= Add media-related context variables to the context. MEDIA_URL)rr4r r r r mediaJr3r5cCsd|iS)Nr r r r r r r Qsr )__doc__r django.confrdjango.middleware.csrfrdjango.utils.functionalrrrrr+r/r2r5r r r r r s