
vÅÏ^<  ã               @   s<   d  d l  m Z d  d l m Z d d „  Z d d „  Z d S)é    )Úwraps)Úpatch_vary_headersc                 s   ‡  f d d †  } | S)a  
    A view decorator that adds the specified headers to the Vary header of the
    response. Usage:

       @vary_on_headers('Cookie', 'Accept-language')
       def index(request):
           ...

    Note that the header names are not case-sensitive.
    c                s%   t  ˆ  ƒ ‡  ‡ f d d †  ƒ } | S)Nc                 s    ˆ  |  | Ž  } t  | ˆ ƒ | S)N)r   )ÚargsÚkwargsÚresponse)ÚfuncÚheaders© ú>/tmp/pip-build-8lau8j11/django/django/views/decorators/vary.pyÚ
inner_func   s    z6vary_on_headers.<locals>.decorator.<locals>.inner_func)r   )r   r   )r   )r   r
   Ú	decorator   s    !z"vary_on_headers.<locals>.decoratorr	   )r   r   r	   )r   r
   Úvary_on_headers   s    r   c                s"   t  ˆ  ƒ ‡  f d d †  ƒ } | S)zÙ
    A view decorator that adds "Cookie" to the Vary header of a response. This
    indicates that a page's contents depends on cookies. Usage:

        @vary_on_cookie
        def index(request):
            ...
    c                 s    ˆ  |  | Ž  } t  | d ƒ | S)NÚCookie)zCookie)r   )r   r   r   )r   r	   r
   r   $   s    z"vary_on_cookie.<locals>.inner_func)r   )r   r   r	   )r   r
   Úvary_on_cookie   s    	r   N)Ú	functoolsr   Zdjango.utils.cacher   r   r   r	   r	   r	   r
   Ú<module>   s   