ó
*Pc           @  sŠ   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d d l m Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d S(   u(  
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 setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
i˙˙˙˙(   t   unicode_literals(   t   settings(   t	   get_token(   t   six(   t
   smart_text(   t   lazyc           s/     f d   } t  | t j  } i |   d 6S(   u    
    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  k r d St |   Sd  S(   Nu   NOTPROVIDED(   R   t   NoneR   (   t   token(   t   request(    s7   ../Django//lib/python/django/core/context_processors.pyt   _get_val   s    u
   csrf_token(   R   R   t	   text_type(   R   R	   (    (   R   s7   ../Django//lib/python/django/core/context_processors.pyt   csrf   s    	c         C  sX   i  } t  j rT |  j j d  t  j k rT t | d <d d l m } | j | d <n  | S(   u0   Returns context variables helpful for debugging.u   REMOTE_ADDRu   debugi˙˙˙˙(   t
   connectionu   sql_queries(	   R   t   DEBUGt   METAt   gett   INTERNAL_IPSt   Truet	   django.dbR   t   queries(   R   t   context_extrasR   (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   debug$   s    $
c         C  sG   d d l  m } i  } t j | d <| j   | d <| j   | d <| S(   Ni˙˙˙˙(   t   translationu	   LANGUAGESu   LANGUAGE_CODEu   LANGUAGE_BIDI(   t   django.utilsR   R   t	   LANGUAGESt   get_languaget   get_language_bidi(   R   R   R   (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   i18n-   s    c         C  s!   d d l  m } i | j   d 6S(   Ni˙˙˙˙(   t   timezoneu	   TIME_ZONE(   R   R   t   get_current_timezone_name(   R   R   (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   tz7   s    c         C  s   i t  j d 6S(   u@   
    Adds static-related context variables to the context.

    u
   STATIC_URL(   R   t
   STATIC_URL(   R   (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   static<   s    c         C  s   i t  j d 6S(   u?   
    Adds media-related context variables to the context.

    u	   MEDIA_URL(   R   t	   MEDIA_URL(   R   (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   mediaC   s    c         C  s   i |  d 6S(   Nu   request(    (   R   (    (    s7   ../Django//lib/python/django/core/context_processors.pyR   J   s    N(   t   __doc__t
   __future__R    t   django.confR   t   django.middleware.csrfR   R   R   t   django.utils.encodingR   t   django.utils.functionalR   R   R   R   R   R    R"   R   (    (    (    s7   ../Django//lib/python/django/core/context_processors.pyt   <module>   s   				
			