o
    ^"<fi
  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚSessionBase)Úsigningc                   @   sV   e Zd Zdd„ Zdd„ Zddd„Zdd	d
„Zddd„Zdd„ Zdd„ Z	e
dd„ ƒZdS )ÚSessionStorec                 C   s:   zt j| j| j|  ¡ ddW S  ty   |  ¡  Y i S w )z½
        Load the data from the key itself instead of fetching from some
        external data store. Opposite of _get_session_key(), raise BadSignature
        if signature fails.
        ú/django.contrib.sessions.backends.signed_cookies)Ú
serializerÚmax_ageÚsalt)r   ÚloadsÚsession_keyr   Úget_session_cookie_ageÚ	ExceptionÚcreate©Úself© r   úf/var/www/html/kck/venv/lib/python3.10/site-packages/django/contrib/sessions/backends/signed_cookies.pyÚload   s   û
üzSessionStore.loadc                 C   s
   d| _ dS )z…
        To create a new key, set the modified flag so that the cookie is set
        on the client for the current request.
        TN)Úmodifiedr   r   r   r   r      s   
zSessionStore.createFc                 C   s   |   ¡ | _d| _dS )zº
        To save, get the session key as a securely signed string and then set
        the modified flag so that the cookie is set on the client for the
        current request.
        TN)Ú_get_session_keyÚ_session_keyr   )r   Úmust_creater   r   r   Úsave"   s   

zSessionStore.saveNc                 C   s   dS )zµ
        This method makes sense when you're talking to a shared resource, but
        it doesn't matter when you're storing the information in the client's
        cookie.
        Fr   ©r   r
   r   r   r   Úexists+   s   zSessionStore.existsc                 C   s   d| _ i | _d| _dS )z¿
        To delete, clear the session key and the underlying data structure
        and set the modified flag so that the cookie is set on the client for
        the current request.
        Ú TN)r   Ú_session_cacher   r   r   r   r   Údelete3   s   
zSessionStore.deletec                 C   s   |   ¡  dS )zž
        Keep the same data but with a new key. Call save() and it will
        automatically save a cookie with a new key at the end of the request.
        N)r   r   r   r   r   Ú	cycle_key=   s   zSessionStore.cycle_keyc                 C   s   t j| jdd| jdS )z
        Instead of generating a random string, generate a secure url-safe
        base64-encoded string of data as our session key.
        Tr   )Úcompressr   r   )r   ÚdumpsÚ_sessionr   r   r   r   r   r   D   s
   ýzSessionStore._get_session_keyc                 C   s   d S ©Nr   )Úclsr   r   r   Úclear_expiredO   s   zSessionStore.clear_expired)Fr!   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   Úclassmethodr#   r   r   r   r   r      s    

	

r   N)Ú%django.contrib.sessions.backends.baser   Údjango.corer   r   r   r   r   r   Ú<module>   s    