ó
ů˘TQc           @   sˇ   d  d l  m  Z  d  d l m Z d  d l m Z d a d Z d e f d     YZ	 d e
 f d     YZ d	 e f d
     YZ d e f d     YZ d   Z d e f d     YZ d S(   i˙˙˙˙(   t   copy(   t   ImproperlyConfigured(   t   import_modules#   django.core.context_processors.csrft   ContextPopExceptionc           B   s   e  Z d  Z RS(   s,   pop() has been called more times than push()(   t   __name__t
   __module__t   __doc__(    (    (    s0   ../Django//lib/python/django/template/context.pyR      s   t   BaseContextc           B   s   e  Z d d   Z d d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d d  Z d d  Z RS(   c         C   s   |  j  |  d  S(   N(   t   _reset_dicts(   t   selft   dict_(    (    s0   ../Django//lib/python/django/template/context.pyt   __init__   s    c         C   sJ   i t  d 6t d 6d  d 6} | g |  _ | d  k	 rF |  j j |  n  d  S(   Nt   Truet   Falset   None(   R   R   R   t   dictst   append(   R	   t   valuet   builtins(    (    s0   ../Django//lib/python/django/template/context.pyR      s    c         C   s&   t  t t |    } |  j | _ | S(   N(   R    t   superR   R   (   R	   t	   duplicate(    (    s0   ../Django//lib/python/django/template/context.pyt   __copy__   s    c         C   s   t  |  j  S(   N(   t   reprR   (   R	   (    (    s0   ../Django//lib/python/django/template/context.pyt   __repr__   s    c         c   s#   x t  |  j  D] } | Vq Wd  S(   N(   t   reversedR   (   R	   t   d(    (    s0   ../Django//lib/python/django/template/context.pyt   __iter__"   s    c         C   s   i  } |  j  j |  | S(   N(   R   R   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyt   push&   s    c         C   s+   t  |  j  d k r t  n  |  j j   S(   Ni   (   t   lenR   R   t   pop(   R	   (    (    s0   ../Django//lib/python/django/template/context.pyR   +   s    	c         C   s   | |  j  d | <d S(   s%   Set a variable in the current contexti˙˙˙˙N(   R   (   R	   t   keyR   (    (    s0   ../Django//lib/python/django/template/context.pyt   __setitem__0   s    c         C   s>   x+ t  |  j  D] } | | k r | | Sq Wt |   d S(   sH   Get a variable's value, starting at the current context and going upwardN(   R   R   t   KeyError(   R	   R   R   (    (    s0   ../Django//lib/python/django/template/context.pyt   __getitem__4   s    c         C   s   |  j  d | =d S(   s*   Delete a variable from the current contexti˙˙˙˙N(   R   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyt   __delitem__;   s    c         C   s(   x! |  j  D] } | | k r
 t Sq
 Wt S(   N(   R   R   R   (   R	   R   R   (    (    s0   ../Django//lib/python/django/template/context.pyt   has_key?   s    c         C   s   |  j  |  S(   N(   R#   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyt   __contains__E   s    c         C   s2   x+ t  |  j  D] } | | k r | | Sq W| S(   N(   R   R   (   R	   R   t	   otherwiseR   (    (    s0   ../Django//lib/python/django/template/context.pyt   getH   s    c         C   s   t  |   } | j |  | S(   s|   
        Returns a new context with the same properties, but with only the
        values given in 'values' stored.
        (   R    R   (   R	   t   valuest   new_context(    (    s0   ../Django//lib/python/django/template/context.pyt   newN   s    N(   R   R   R   R   R   R   R   R   R   R   R   R!   R"   R#   R$   R&   R)   (    (    (    s0   ../Django//lib/python/django/template/context.pyR      s   										t   Contextc           B   s8   e  Z d  Z d e d d d d  Z d   Z d   Z RS(   s&   A stack container for variable contextc         C   sJ   | |  _  | |  _ | |  _ | |  _ t   |  _ t t |   j |  d  S(   N(	   t
   autoescapet   current_appt   use_l10nt   use_tzt   RenderContextt   render_contextR   R*   R   (   R	   R
   R+   R,   R-   R.   (    (    s0   ../Django//lib/python/django/template/context.pyR   Y   s    				c         C   s+   t  t |   j   } t |  j  | _ | S(   N(   R   R*   R   R    R0   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyR   b   s    c         C   s2   t  | d  s t d   n  |  j j |  | S(   s=   Pushes other_dict to the stack of dictionaries in the ContextR!   s6   other_dict must be a mapping (dictionary-like) object.(   t   hasattrt	   TypeErrorR   R   (   R	   t
   other_dict(    (    s0   ../Django//lib/python/django/template/context.pyt   updateg   s    N(   R   R   R   R   R   R   R   R4   (    (    (    s0   ../Django//lib/python/django/template/context.pyR*   W   s
   		R/   c           B   s,   e  Z d  Z d   Z d   Z d d  Z RS(   sČ  
    A stack container for storing Template state.

    RenderContext simplifies the implementation of template Nodes by providing a
    safe place to store state between invocations of a node's `render` method.

    The RenderContext also provides scoping rules that are more sensible for
    'template local' variables. The render context stack is pushed before each
    template is rendered, creating a fresh scope with nothing in it. Name
    resolution fails if a variable is not found at the top of the RequestContext
    stack. Thus, variables are local to a specific template and don't affect the
    rendering of other templates as they would if they were stored in the normal
    template context.
    c         c   s!   x |  j  d D] } | Vq Wd  S(   Ni˙˙˙˙(   R   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyR   }   s    c         C   s   | |  j  d k S(   Ni˙˙˙˙(   R   (   R	   R   (    (    s0   ../Django//lib/python/django/template/context.pyR#      s    c         C   s%   |  j  d } | | k r! | | S| S(   Ni˙˙˙˙(   R   (   R	   R   R%   R   (    (    s0   ../Django//lib/python/django/template/context.pyR&      s    N(   R   R   R   R   R#   R   R&   (    (    (    s0   ../Django//lib/python/django/template/context.pyR/   n   s   		c    
      C   s  d d l  m }  t d  k rg  } g  } | j t  | j |  j  xź | D]´ } | j d  } | |  | | d } } y t |  } Wn) t	 k
 rľ } t
 d | | f   n Xy t | |  }	 Wn' t k
 rň t
 d | | f   n X| j |	  qL Wt |  a n  t S(   Ni˙˙˙˙(   t   settingst   .i   s1   Error importing request processor module %s: "%s"s=   Module "%s" does not define a "%s" callable request processor(   t   django.confR5   t   _standard_context_processorsR   t   extendt   _builtin_context_processorst   TEMPLATE_CONTEXT_PROCESSORSt   rfindR   t   ImportErrorR   t   getattrt   AttributeErrorR   t   tuple(
   R5   t
   processorst   collectt   patht   it   modulet   attrt   modt   et   func(    (    s0   ../Django//lib/python/django/template/context.pyt   get_standard_processors   s(    t   RequestContextc           B   s&   e  Z d  Z d d d d d d  Z RS(   sú   
    This subclass of template.Context automatically populates itself using
    the processors defined in TEMPLATE_CONTEXT_PROCESSORS.
    Additional processors can be specified as a list of callables
    using the "processors" keyword argument.
    c      	   C   sr   t  j |  | d | d | d | | d  k r7 d } n t |  } x( t   | D] } |  j | |   qQ Wd  S(   NR,   R-   R.   (    (   R*   R   R   R@   RJ   R4   (   R	   t   requestR
   RA   R,   R-   R.   t	   processor(    (    s0   ../Django//lib/python/django/template/context.pyR   Ş   s    	N(   R   R   R   R   R   (    (    (    s0   ../Django//lib/python/django/template/context.pyRK   Ł   s   	N(   s#   django.core.context_processors.csrf(   R    t   django.core.exceptionsR   t   django.utils.importlibR   R   R8   R:   t	   ExceptionR   t   objectR   R*   R/   RJ   RK   (    (    (    s0   ../Django//lib/python/django/template/context.pyt   <module>   s   G	