https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/sessions/backends/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/sessions/backends/__pycache__/file.cpython-310.pyc
o

3�a<�@s�ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZddlm
Z
ddlmZmZddlmZGdd�de
�ZdS)	�N)�settings)�VALID_KEY_CHARS�CreateError�SessionBase�UpdateError)�InvalidSessionKey)�ImproperlyConfigured�SuspiciousOperation)�timezonecs�eZdZdZd�fdd�	Zedd��Zddd�Zd	d
�Zdd�Z	d
d�Z
dd�Zddd�Zdd�Z
ddd�Zdd�Zedd��Z�ZS)�SessionStorez/
    Implement a file based session store.
    Ncs"|��|_tj|_t��|�dS�N)�_get_storage_path�storage_pathr�SESSION_COOKIE_NAME�file_prefix�super�__init__��self�session_key��	__class__��G/usr/lib/python3/dist-packages/django/contrib/sessions/backends/file.pyrs
zSessionStore.__init__cCsRz|jWSty(ttdd�pt��}tj�|�s!t	d|��||_|YSw)N�SESSION_FILE_PATHz�The session storage path %r doesn't exist. Please set your SESSION_FILE_PATH setting to an existing directory in which Django can store session data.)
�
_storage_path�AttributeError�getattrr�tempfile�
gettempdir�os�path�isdirr)�clsrrrrr
s���zSessionStore._get_storage_pathcCs<|dur|��}t|��t�std��tj�|j|j	|�S)z@
        Get the file associated with this session key.
        Nz!Invalid characters in session key)
�_get_or_create_session_key�set�issubsetrrr r!�joinrrrrrr�_key_to_file)s�zSessionStore._key_to_filecCs<t�|���j}tjrtj�|�}|jt	j
d�Stj�|�S)zY
        Return the modification time of the file storing the session's content.
        )�tzinfo)r �statr(�st_mtimer�USE_TZ�datetime�utcfromtimestamp�replacer
�utc�
fromtimestamp)r�modificationrrr�_last_modification9s
zSessionStore._last_modificationcCs"|�d�p|��tj|��d�S)zS
        Return the expiry time of the file storing the session's content.
        �_session_expiry)�seconds)�getr3r-�	timedelta�get_session_cookie_age)r�session_datarrr�_expiry_dateCs
�zSessionStore._expiry_datec
Cs
i}zst|��dd��}|��}Wd�n1swY|rpz|�|�}Wn-ttfyU}zt|t�rGt�d|j	j
�}|�t|��|�
�WYd}~nd}~ww|j|�|�d�}|dkrsi}|��|�
�W|SW|SW|Sttfy�d|_Y|Sw)N�ascii)�encodingzdjango.security.%s)�expiryr)�openr(�read�decode�EOFErrorr	�
isinstance�logging�	getLoggerr�__name__�warning�str�create�get_expiry_ager:�delete�OSError�_session_key)rr9�session_file�	file_data�e�logger�
expiry_agerrr�loadKs:
�
��
����zSessionStore.loadcCs:	|��|_z|jdd�Wn	tyYqwd|_dS)NT)�must_create)�_get_new_session_keyrL�saver�modified�rrrrrHes
�zSessionStore.createFc	CsP|jdur	|��S|j|d�}|��}z tjttdd�B}|r'|tjtjBO}t�	||�}t�
|�Wnty@|s>t�Yn
t
yL|rJt�Ynwtj�|�\}}zFtj||dd�\}}	d}
z/zt�||�|����Wt�
|�nt�
|�wt�|	|�d}
W|
s�t�|	�WdSWdS|
s�t�|	�wwttfy�YdSw)N)�no_load�O_BINARYr�_out_)�dir�prefixFT)rrH�_get_sessionr(r �O_WRONLYr�O_EXCL�O_CREATr>�close�FileNotFoundErrorr�FileExistsErrorrr!�splitr�mkstemp�write�encode�shutil�move�unlinkrArK)rrSr9�session_file_name�flags�fdr[r\�output_file_fd�output_file_name�renamedrrrrUosJ
���
���zSessionStore.savecCstj�|�|��Sr)r r!�existsr(rrrrrq�szSessionStore.existscCsH|dur|jdurdS|j}zt�|�|��WdSty#YdSwr)rr rjr(rKrrrrrJ�s
�zSessionStore.deletecC�dSrrrWrrr�clean�szSessionStore.cleancCsX|��}tj}t�|�D]}|�|�sq|t|�d�}||�}dd�|_|��qdS)NcSrrrrrrrr�<lambda>�sz,SessionStore.clear_expired.<locals>.<lambda>)	r
rrr �listdir�
startswith�lenrHrR)r#rrrMr�sessionrrr�
clear_expired�s


�zSessionStore.clear_expiredr)F)rE�
__module__�__qualname__�__doc__r�classmethodr
r(r3r:rRrHrUrqrJrsry�
__classcell__rrrrrs 




=

r)r-rCr rhr�django.confr�%django.contrib.sessions.backends.baserrrr�"django.contrib.sessions.exceptionsr�django.core.exceptionsrr	�django.utilsr
rrrrr�<module>s

https://t.me/RX1948 - 2025