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/contrib/messages/storage/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/contrib/messages/storage/cookie.pyc
�
r�\c@s�ddlZddlmZddlmZmZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZdejfd	��YZd
ejfd��YZdefd
��YZdS(i����N(tsettings(tBaseStoragetMessage(tSimpleCookie(tsalted_hmactconstant_time_compare(tSafeDatat	mark_safe(tsixtMessageEncodercBseZdZdZd�ZRS(sJ
    Compactly serializes instances of the ``Message`` class as JSON.
    t__json_messagecCs~t|t�rht|jt�r'dnd}|j||j|jg}|jrd|j|j�n|Stt	|�j
|�S(Nii(t
isinstanceRtmessageRtmessage_keytlevelt
extra_tagstappendtsuperR	tdefault(tselftobjtis_safedataR((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyRs	(t__name__t
__module__t__doc__R
R(((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR	stMessageDecodercBs eZdZd�Zd�ZRS(sF
    Decodes JSON that includes serialized ``Message`` instances.
    cCs�t|t�r�|r�|dtjkrwt|�dkrHt|d�S|drit|d�|d<nt|d�Sg|D]}|j|�^q~St|t�r�tgt	j
|�D]!\}}||j|�f^q��S|S(Niiii(RtlistR	R
tlenRRtprocess_messagestdictRt	iteritems(RRtitemtkeytvalue((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR!s
 5cKs(tt|�j||�}|j|�S(N(RRtdecodeR(Rtstkwargstdecoded((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR"0s(RRRRR"(((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyRs	t
CookieStoragecBs\eZdZdZdZdZd�Zd�Zed�Z	d�Z
ed�Zd	�Z
RS(
s&
    Stores messages in a cookie.
    tmessagesit__messagesnotfinished__cOse|jjj|j�}|j|�}|o=|d|jk}|r[|r[|j�n||fS(s
        Retrieves a list of messages from the messages cookie.  If the
        not_finished sentinel value is found at the end of the message list,
        remove it and return a result indicating that not all messages were
        retrieved by this storage.
        i����(trequesttCOOKIEStgettcookie_namet_decodetnot_finishedtpop(RtargsR$tdataR't
all_retrieved((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt_get?s

cCsB|r%|j|j|dtj�n|j|jdtj�dS(s|
        Either sets the cookie with the encoded data if there is any data to
        store, or deletes the cookie.
        tdomainN(t
set_cookieR,RtSESSION_COOKIE_DOMAINt
delete_cookie(Rtencoded_datatresponse((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt_update_cookieNs

c	s�g}|j|�}|jr�t���fd�}xv|r�||�|jkr�|rs|j|jd��n|jd|j��|j||jgd|�}q9Wn|j||�|S(sV
        Stores the messages to a cookie, returning a list of any messages which
        could not be stored.

        If the encoded data is larger than ``max_cookie_size``, removes
        messages until the data fits (these are the messages which are
        returned), and add the not_finished sentinel value to indicate as much.
        cst�j|�d�S(Ni(Rtvalue_encode(tval(tcookie(sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt
stored_lengthisitencode_empty(t_encodetmax_cookie_sizeRRR/tinsertR.R:(	RR'R9t
remove_oldestR0R$tunstored_messagesR8R>((R=sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt_storeZs			cCsd}t||�j�S(s�
        Creates an HMAC/SHA1 hash based on the value and the project setting's
        SECRET_KEY, modified to make it unique for the present purpose.
        sdjango.contrib.messages(Rt	hexdigest(RR!tkey_salt((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt_hashvscCsE|s|rAtdd�}|j|�}d|j|�|fSdS(s	
        Returns an encoded version of the messages list which can be stored as
        plain text.

        Since the data will be retrieved from the client-side, the encoded data
        also contains a hash to ensure that the data was not tampered with.
        t
separatorst,t:s%s$%sN(RJRK(R	tencodeRH(RR'R?tencoderR!((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR@~scCs�|s
dS|jdd�}t|�dkr�|\}}t||j|��r�ytj|dt�SWq�tk
r|q�Xq�nt	|_
dS(s�
        Safely decodes a encoded text stream back into a list of messages.

        If the encoded text stream contained an invalid hash or was in an
        invalid format, ``None`` is returned.
        t$iitclsN(tNonetsplitRRRHtjsontloadsRt
ValueErrortTruetused(RR1tbitsthashR!((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR-�s

	(RRRR,RAR.R3R:RURERHtFalseR@R-(((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyR&4s			
(RRtdjango.confRt$django.contrib.messages.storage.baseRRtdjango.httpRtdjango.utils.cryptoRRtdjango.utils.safestringRRtdjango.utilsRtJSONEncoderR	tJSONDecoderRR&(((sH/tmp/pip-install-XxeQeY/django/django/contrib/messages/storage/cookie.pyt<module>s

https://t.me/AnonymousX5 - 2025