ó
    _š‘h'!  ã                   ó¤   • S r SSKrSSKJr  SSKJrJr  SSKJrJ	r	J
r
JrJr  SSKJr  SSKJr   " S S	\5      r " S
 S\5      r " S S\\5      rg)aØ  
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::

    MIDDLEWARE = [
        'django.middleware.cache.UpdateCacheMiddleware',
        ...
        'django.middleware.cache.FetchFromCacheMiddleware'
    ]

This is counterintuitive, but correct: ``UpdateCacheMiddleware`` needs to run
last during the response phase, which processes middleware bottom-up;
``FetchFromCacheMiddleware`` needs to run last during the request phase, which
processes middleware top-down.

The single-class ``CacheMiddleware`` can be used for some simple sites.
However, if any other piece of middleware needs to affect the cache key, you'll
need to use the two-part ``UpdateCacheMiddleware`` and
``FetchFromCacheMiddleware``. This'll most often happen when you're using
Django's ``LocaleMiddleware``.

More details about how the caching works:

* Only GET or HEAD-requests with status code 200 are cached.

* The number of seconds each page is stored for is set by the "max-age" section
  of the response's "Cache-Control" header, falling back to the
  CACHE_MIDDLEWARE_SECONDS setting if the section was not found.

* This middleware expects that a HEAD request is answered with the same response
  headers exactly like the corresponding GET request.

* When a hit occurs, a shallow copy of the original response object is returned
  from process_request.

* Pages will be cached based on the contents of the request headers listed in
  the response's "Vary" header.

* This middleware also sets ETag, Last-Modified, Expires and Cache-Control
  headers on the response object.

é    N)Úsettings)ÚDEFAULT_CACHE_ALIASÚcaches)Úget_cache_keyÚget_max_ageÚhas_vary_headerÚlearn_cache_keyÚpatch_response_headers)ÚMiddlewareMixin)Úparse_http_date_safec                   óH   ^ • \ rS rSrSrU 4S jr\S 5       rS rS r	Sr
U =r$ )ÚUpdateCacheMiddlewareé=   a  
Response-phase cache middleware that updates the cache if the response is
cacheable.

Must be used as part of the two-part update/fetch cache middleware.
UpdateCacheMiddleware must be the first piece of middleware in MIDDLEWARE
so that it'll get called last during the response phase.
c                 ó°   >• [         TU ]  U5        [        R                  U l        S U l        [        R                  U l        [        R                  U l	        g ©N)
ÚsuperÚ__init__r   ÚCACHE_MIDDLEWARE_SECONDSÚcache_timeoutÚpage_timeoutÚCACHE_MIDDLEWARE_KEY_PREFIXÚ
key_prefixÚCACHE_MIDDLEWARE_ALIASÚcache_alias©ÚselfÚget_responseÚ	__class__s     €Ú[C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\django/middleware/cache.pyr   ÚUpdateCacheMiddleware.__init__G   sA   ø€ Ü‰Ñ˜Ô&Ü%×>Ñ>ˆÔØ ˆÔÜ"×>Ñ>ˆŒÜ#×:Ñ:ˆÕó    c                 ó(   • [         U R                     $ r   ©r   r   ©r   s    r   ÚcacheÚUpdateCacheMiddleware.cacheN   ó   € ä�d×&Ñ&Ñ'Ð'r!   c                 ó@   • [        US5      =(       a    UR                  $ )NÚ_cache_update_cache)Úhasattrr)   )r   ÚrequestÚresponses      r   Ú_should_update_cacheÚ*UpdateCacheMiddleware._should_update_cacheR   s   € Ü�wÐ 5Ó6×V¸7×;VÑ;VÐVr!   c                 óÈ  ^ ^^• T R                  X5      (       d  U$ UR                  (       d  UR                  S;  a  U$ UR                  (       d$  UR                  (       a  [        US5      (       a  U$ SUR                  SS5      ;   a  U$ T R                  mTc#  [        U5      mTc  T R                  mOTS:X  a  U$ [        UT5        T(       a‘  UR                  S:X  a�  [        XTT R                  T R                  S9m[        US	5      (       a3  [        UR                   5      (       a  UR#                  UU U4S
 j5        U$ T R                  R%                  TUT5        U$ )zSet the cache, if needed.)éÈ   i0  ÚCookieÚprivatezCache-Control© r   r0   ©r%   Úrenderc                 ó>   >• TR                   R                  TU T5      $ r   )r%   Úset)ÚrÚ	cache_keyr   Útimeouts    €€€r   Ú<lambda>Ú8UpdateCacheMiddleware.process_response.<locals>.<lambda>~   s   ø€ ˜dŸj™jŸn™n¨Y¸¸7ÔCr!   )r-   Ú	streamingÚstatus_codeÚCOOKIESÚcookiesr   Úgetr   r   r   r
   r	   r   r%   r*   Úcallabler5   Úadd_post_render_callbackr7   )r   r+   r,   r9   r:   s   `  @@r   Úprocess_responseÚ&UpdateCacheMiddleware.process_responseU   s1  ú€ à×(Ñ(¨×;Ñ;àˆOà×× ×!5Ñ!5¸ZÓ!GØˆOð
 ——Ø× × Ü ¨(×3Ñ3àˆOð ˜Ÿ™ _°bÓ9Ó9ØˆOð ×#Ñ#ˆØ‰?ô " (Ó+ˆGØ‰Ø×,Ñ,‘Ø˜A“à�Ü˜x¨Ô1Þ�x×+Ñ+¨sÓ2Ü'Ø 7¨D¯O©OÀ4Ç:Á:ñˆIô �x ×*Ñ*¬x¸¿¹×/HÑ/HØ×1Ñ1ÞCôð
 ˆð —
‘
—‘˜y¨(°GÔ<Øˆr!   ©r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr%   r-   rD   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r   =   s1   ø† ñõ;ð ñ(ó ð(òW÷-ð -r!   r   c                   óB   ^ • \ rS rSrSrU 4S jr\S 5       rS rSr	U =r
$ )ÚFetchFromCacheMiddlewareé…   a  
Request-phase cache middleware that fetches a page from the cache.

Must be used as part of the two-part update/fetch cache middleware.
FetchFromCacheMiddleware must be the last piece of middleware in MIDDLEWARE
so that it'll get called last during the request phase.
c                 óx   >• [         TU ]  U5        [        R                  U l        [        R
                  U l        g r   )r   r   r   r   r   r   r   r   s     €r   r   Ú!FetchFromCacheMiddleware.__init__Ž   s+   ø€ Ü‰Ñ˜Ô&Ü"×>Ñ>ˆŒÜ#×:Ñ:ˆÕr!   c                 ó(   • [         U R                     $ r   r#   r$   s    r   r%   ÚFetchFromCacheMiddleware.cache“   r'   r!   c                 ó$  • UR                   S;  a  SUl        g[        XR                  SU R                  S9nUc  SUl        gU R                  R                  U5      nUcJ  UR                   S:X  a:  [        XR                  SU R                  S9nU R                  R                  U5      nUc  SUl        g[        U5      =nbE  [        US   5      =n b3  [        [        R                  " 5       5      nXV-
  n[        S	XG-
  5      US
'   SUl        U$ )zV
Check whether the page is already cached and return the cached
version if available.
)ÚGETÚHEADFNrX   r4   TrY   ÚExpiresr   ÚAge)Úmethodr)   r   r   r%   rA   r   r   ÚintÚtimeÚmax)r   r+   r9   r,   Úmax_age_secondsÚexpires_timestampÚnow_timestampÚremaining_secondss           r   Úprocess_requestÚ(FetchFromCacheMiddleware.process_request—   s  € ð
 �>‰> Ó0Ø*/ˆGÔ'Øô " '¯?©?¸EÈÏÉÑTˆ	ØÑØ*.ˆGÔ'ØØ—:‘:—>‘> )Ó,ˆàÑ §¡°&Ó 8Ü%ØŸ™¨&¸¿
¹
ñˆIð —z‘z—~‘~ iÓ0ˆHàÑØ*.ˆGÔ'Øô  +¨8Ó4Ð4ˆOÑAÜ!5°h¸yÑ6IÓ!JÐJÐØñGô  ¤§	¢	£Ó,ˆMØ 1Ñ AÐä! ! _Ñ%HÓIˆH�U‰Oð ',ˆÔ#Øˆr!   )r   r   )rG   rH   rI   rJ   rK   r   rL   r%   rd   rM   rN   rO   s   @r   rQ   rQ   …   s+   ø† ñõ;ð
 ñ(ó ð(÷%ð %r!   rQ   c                   ó0   ^ • \ rS rSrSrSU 4S jjrSrU =r$ )ÚCacheMiddlewareé¿   z¼
Cache middleware that provides basic behavior for many simple sites.

Also used as the hook point for the cache decorator, which is generated
using the decorator-from-middleware utility.
c                 óÎ   >• [         TU ]  U5         US   nUc  SnXPl         US   nUc  [        nX`l        Ub  X l        X0l        g ! [         a     N1f = f! [         a     N,f = f)Nr   Ú r   )r   r   r   ÚKeyErrorr   r   r   r   )r   r   r   r   Úkwargsr   r   r   s          €r   r   ÚCacheMiddleware.__init__Ç   sŠ   ø€ Ü‰Ñ˜Ô&ð	Ø Ñ-ˆJØÑ!Ø�
Ø(ŒOð	Ø  Ñ/ˆKØÑ"Ü1�Ø*Ôð Ñ$Ø!.ÔØ(Õøô ó 	Ùð	ûô ó 	Ùð	ús"   ’A £A Á
AÁAÁ
A$Á#A$rF   )NN)rG   rH   rI   rJ   rK   r   rM   rN   rO   s   @r   rg   rg   ¿   s   ø† ñ÷)õ )r!   rg   )rK   r^   Údjango.confr   Údjango.core.cacher   r   Údjango.utils.cacher   r   r   r	   r
   Údjango.utils.deprecationr   Údjango.utils.httpr   r   rQ   rg   r3   r!   r   Ú<module>rs      sT   ðñ+óZ å  ß 9÷õ õ 5Ý 2ôE˜Oô EôP7˜ô 7ôt )Ð+Ð-Eõ  )r!   