o
    {,h	                     @   sp   d Z ddlZddlmZ ddlmZ ddlmZmZ dd Z	dd	 Z
d
d Zdd Zdd Zdd Zdd ZdS )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)SimpleLazyObjectlazyc                    s    fdd}dt |iS )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
    c                     s   t  } | d u r
dS | S )NNOTPROVIDEDr   )tokenrequest X/var/www/html/rh/venv/lib/python3.10/site-packages/django/template/context_processors.py_get_val   s   zcsrf.<locals>._get_val
csrf_token)r   )r
   r   r   r	   r   csrf   s   
r   c                    sJ   i }t jr#| jdt jv r#d|d< ddlm  t fddt|d< |S )	z9
    Return context variables helpful for debugging.
    REMOTE_ADDRTdebugr   connectionsc                      s   t tj fdd D S )Nc                 3   s    | ]} | j V  qd S )N)queries).0xr   r   r   	<genexpr>1   s    

z*debug.<locals>.<lambda>.<locals>.<genexpr>)list	itertoolschainfrom_iterabler   r   r   r   <lambda>0   s
    zdebug.<locals>.<lambda>sql_queries)	r   DEBUGMETAgetINTERNAL_IPS	django.dbr   r   r   )r
   context_extrasr   r   r   r   $   s   
r   c                 C   s"   ddl m} tj| | dS )Nr   )translation)	LANGUAGESLANGUAGE_CODELANGUAGE_BIDI)django.utilsr$   r   r%   get_languageget_language_bidi)r
   r$   r   r   r   i18n:   s
   r+   c                 C   s   ddl m} d| iS )Nr   )timezone	TIME_ZONE)r(   r,   get_current_timezone_name)r
   r,   r   r   r   tzD   s   r/   c                 C   
   dt jiS )z>
    Add static-related context variables to the context.
    
STATIC_URL)r   r1   r	   r   r   r   staticJ      
r2   c                 C   r0   )z=
    Add media-related context variables to the context.
    	MEDIA_URL)r   r4   r	   r   r   r   mediaQ   r3   r5   c                 C   s   d| iS )Nr
   r   r	   r   r   r   r
   X   s   r
   )__doc__r   django.confr   django.middleware.csrfr   django.utils.functionalr   r   r   r   r+   r/   r2   r5   r
   r   r   r   r   <module>   s    	
