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/views/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/views/__pycache__/debug.cpython-310.pyc
o

3�a�W�@sZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZddl
mZmZmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lm Z edddid�Z!ee"�j#Z$Gdd�de%�Z&Gdd�d�Z'd'dd�Z(e�)�dd��Z*dd�Z+dd�Z,Gdd �d �Z-Gd!d"�d"�Z.d#d$�Z/d%d&�Z0dS)(�N)�Path)�settings)�Http404�HttpResponse�HttpResponseNotFound)�Context�Engine�TemplateDoesNotExist)�pprint)�resolve)�timezone)�MultiValueDict)�	force_str)�
import_string)�_lazy_re_compile)�get_docs_versionT�i18nzdjango.templatetags.i18n)�debug�	librariesc@seZdZdS)�ExceptionCycleWarningN)�__name__�
__module__�__qualname__�rr�4/usr/lib/python3/dist-packages/django/views/debug.pyr src@s eZdZdZdd�Zdd�ZdS)�CallableSettingWrapperz�
    Object to wrap callable appearing in settings.
    * Not to call in the debug page (#21345).
    * Not to break the debug page if the callable forbidding to set attributes
      (#23070).
    cCs
||_dS�N)�_wrapped)�self�callable_settingrrr�__init__+�
zCallableSettingWrapper.__init__cCs
t|j�Sr)�reprr�rrrr�__repr__.r!zCallableSettingWrapper.__repr__N)rrr�__doc__r r$rrrrr$sr��cCsHt|�||||�}|�d�r|��}t||dd�S|��}t||dd�S)z�
    Create a technical server error response. The last three arguments are
    the values returned from sys.exc_info() and friends.
    �	text/html)�status�content_typeztext/plain; charset=utf-8)�get_exception_reporter_class�accepts�get_traceback_htmlr�get_traceback_text)�request�exc_type�	exc_value�tb�status_code�reporter�html�textrrr�technical_500_response2s
r6cCsttj��Sr)rr�!DEFAULT_EXCEPTION_REPORTER_FILTERrrrr�%get_default_exception_reporter_filter@sr8cCst�}t|d|�S)N�exception_reporter_filter)r8�getattr)r.�default_filterrrr�get_exception_reporter_filterFsr<cCsttj�}t|d|�S)N�exception_reporter_class)rr�DEFAULT_EXCEPTION_REPORTERr:)r.� default_exception_reporter_classrrrr*Ks
r*c@sbeZdZdZdZedejd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�ZdS)�SafeExceptionReporterFilterz�
    Use annotations made by the sensitive_post_parameters and
    sensitive_variables decorators to filter out sensitive information.
    z********************z#API|TOKEN|KEY|SECRET|PASS|SIGNATURE)�flagscs�z�j�|�}Wntyd}Ynw|r�j}n3t|t�r+�fdd�|��D�}n"t|t�r:�fdd�|D�}nt|t�rKt�fdd�|D��}n|}t	|�rUt
|�}|S)z�
        Cleanse an individual setting key/value of sensitive content. If the
        value is a dictionary, recursively cleanse the keys in that dictionary.
        Fc�i|]\}}|��||��qSr��cleanse_setting��.0�k�vr#rr�
<dictcomp>e�z?SafeExceptionReporterFilter.cleanse_setting.<locals>.<dictcomp>c�g|]}��d|��qS��rC�rFrHr#rr�
<listcomp>g�z?SafeExceptionReporterFilter.cleanse_setting.<locals>.<listcomp>crKrLrCrNr#rrrOirP)�hidden_settings�search�	TypeError�cleansed_substitute�
isinstance�dict�items�list�tuple�callabler)r�key�value�is_sensitive�cleansedrr#rrDXs"�


z+SafeExceptionReporterFilter.cleanse_settingcCs4i}tt�D]}|��r|�|tt|��||<q|S)z�
        Return a dictionary of the settings module with values of sensitive
        settings replaced with stars (*********).
        )�dirr�isupperrDr:)r�
settings_dictrGrrr�get_safe_settingsrs�z-SafeExceptionReporterFilter.get_safe_settingscs&t|d�siS�fdd�|j��D�S)zU
        Return a dictionary of request.META with sensitive values redacted.
        �METAcrBrrCrEr#rrrI�rJzESafeExceptionReporterFilter.get_safe_request_meta.<locals>.<dictcomp>)�hasattrrcrW�rr.rr#r�get_safe_request_meta}s
z1SafeExceptionReporterFilter.get_safe_request_metacCs
tjduS)a
        This filter is to add safety in production environments (i.e. DEBUG
        is False). If DEBUG is True then your site is not safe anyway.
        This hook is provided as a convenience to easily activate or
        deactivate the filter on a per request basis.
        F)r�DEBUGrerrr�	is_active�s
z%SafeExceptionReporterFilter.is_activecCsBt|dg�}|�|�r|r|��}|D]}||vr|j||<q|S)z�
        Replace the keys in a MultiValueDict marked as sensitive with stars.
        This mitigates leaking sensitive POST parameters if something like
        request.POST['nonexistent_key'] throws an exception (#21098).
        �sensitive_post_parameters)r:rh�copyrT)rr.�multivaluedictri�paramrrr�get_cleansed_multivaluedict�s
�z7SafeExceptionReporterFilter.get_cleansed_multivaluedictcCsv|duriSt|dg�}|�|�r8|r8|j��}|dkr(|D]}|j||<q|S|D]}||vr5|j||<q*|S|jS)zk
        Replace the values of POST parameters marked as sensitive with
        stars (*********).
        Nri�__ALL__)r:rh�POSTrjrT)rr.rir^rGrlrrr�get_post_parameters�s

�z/SafeExceptionReporterFilter.get_post_parametersc
CsTzt|t�}Wnty}zd�||�WYd}~Sd}~ww|r(|�||�}|S)Nz{!r} while evaluating {!r})rUr
�	Exception�formatrm)rr.r\�is_multivalue_dict�errr�cleanse_special_types�s��z1SafeExceptionReporterFilter.cleanse_special_typesc	Cs|j}d}|dur'|jjdkr d|jvr |jd}t|dd�}n|j}|dus	i}|�|�r]|r]|dkr@|jD]}|j||<q7n/|j��D]\}}||vrQ|j}n|�||�}|||<qEn|j��D]\}}|�||�||<qb|jjdkr�d|jvr�|j|d<|j|d<|��S)ze
        Replace the values of variables marked as sensitive with
        stars (*********).
        N�sensitive_variables_wrapper�sensitive_variablesrn�	func_args�func_kwargs)	�f_back�f_code�co_name�f_localsr:rhrTrWru)	rr.�tb_frame�
current_framerw�wrapperr^�namer\rrr�get_traceback_frame_variables�s:

�

�
�	


z9SafeExceptionReporterFilter.get_traceback_frame_variablesN)rrrr%rTr�re�IrQrDrbrfrhrmrprur�rrrrr@Ps	r@c@steZdZdZedd��Zedd��Zddd�Zd	d
�Zdd�Z	d
d�Z
dd�Zddd�Zdd�Z
dd�Zdd�ZdS)�ExceptionReporterz0Organize and coordinate reporting on exceptions.cC�tddS)N�	templatesztechnical_500.html��CURRENT_DIRr#rrr�html_template_path��z$ExceptionReporter.html_template_pathcCr�)Nr�ztechnical_500.txtr�r#rrr�text_template_path�r�z$ExceptionReporter.text_template_pathFcCsJ||_t|j�|_||_||_||_||_t|jdd�|_d|_	d|_
dS)N�template_debugF)r.r<�filterr/r0r1�is_emailr:�
template_info�template_does_not_exist�
postmortem)rr.r/r0r1r�rrrr s
zExceptionReporter.__init__cCs�|jrt|jt�rd|_|jjp|jg|_|��}t|�D]8\}}d|vrQg}|dD]!\}}t	|�}t
|�dkrEd|dd�t
|�f}|�||f�q+||d<|||<qd}|jr�t|jt�r�t
|jdd�}t
|jd	d�}	|dur�|	dur�|jjd
}
t|
t|dd�t|	dt
|
���dd
d�}ddlm}|jdur�d}nzt|jj�}Wnty�d}Ynwid|j�d|�d|�d|j�d|j�|j��d|�dt|j�|j�����d|j���dtj �ddtj!dd��dt"�#��d|��dtj$�d |j%�d!|j�d"|j�}
|jdu�r(|jj&��|
d#<|jj'��|
d$<|jj(��|
d%<|j�r2|jj)|
d&<|j�r=t|j�|
d'<|�rF|d(|
d)<|
S)*z5Return a dictionary containing traceback information.T�varsiu%s… <trimmed %d bytes string>rrM�startN�end���ascii�replace)�errors)�get_versionz%[unable to retrieve the current user]r��unicode_hint�framesr.�request_meta�user_str�filtered_POST_itemsr�sys_executable�sys_version_infoz%d.%d.%d��server_time�django_version_info�sys_pathr�r�r��request_GET_items�request_FILES_items�request_COOKIES_items�exception_type�exception_value����	lastframe)*r/�
issubclassr	r�r0�chainr��get_traceback_frames�	enumerater
�len�append�UnicodeErrorr:�argsr�max�min�djangor�r.�str�userrqr�r�rfrXrprWrb�sys�
executable�version_infor�now�pathr��GET�FILES�COOKIESr)rr��i�frame�
frame_varsrGrHr�r�r��unicode_strr�r��crrr�get_traceback_data
s�
"�
��������
�	�
���
����z$ExceptionReporter.get_traceback_datacCsV|jjdd��}t�|���}Wd�n1swYt|��dd�}|�|�S)z1Return HTML version of debug 500 HTTP error page.�utf-8��encodingNF)�use_l10n)r��open�DEBUG_ENGINE�from_string�readrr��render�r�fh�tr�rrrr,Us
�
z$ExceptionReporter.get_traceback_htmlcCsX|jjdd��}t�|���}Wd�n1swYt|��ddd�}|�|�S)z7Return plain text version of debug 500 HTTP error page.r�r�NF)�
autoescaper�)r�r�r�r�r�rr�r�r�rrrr-\s
�
z$ExceptionReporter.get_traceback_textcCs�d}t|d�r z|�|�}Wn	tyYnw|dur |��}|durOz t|d��}|����}Wd�W|S1s=wYW|StyNY|Sw|S)N�
get_source�rb)rdr��ImportError�
splitlinesr�r��OSError)r�filename�loader�module_name�source�fprrr�_get_sourcecs,
�����zExceptionReporter._get_sourceNcs�|�|||�}|durdgdgfSt|dt�r=d�|dd�D]}t�d|�}|r3|d�d��nq �fdd�|D�}td||�}	||}
z||	|�}||}||d|
�}
WntykdgdgfYSw|	|||
fS)	z�
        Return context_lines before and after lineno from file.
        Return (pre_context_lineno, pre_context, context_line, post_context).
        Nrr��scoding[:=]\s*([-\w.]+)r�csg|]}t|�d��qS)r�)r�)rF�sliner�rrrO�rPz:ExceptionReporter._get_lines_from_file.<locals>.<listcomp>)r�rU�bytesr�rR�decoder��
IndexError)rr��lineno�
context_linesr�r�r��line�match�lower_bound�upper_bound�pre_context�context_line�post_contextrr�r�_get_lines_from_filets,��z&ExceptionReporter._get_lines_from_filecCs4t|dd�}t|dd�}t|dd�}|p|rdS|S)N�	__cause__�__suppress_context__�__context__)r:)rr0�explicit�suppress_context�implicitrrr�_get_explicit_or_implicit_cause�sz1ExceptionReporter._get_explicit_or_implicit_causecCs�g}|j}|r |�|�|�|�}||vrt�d|t�n|sg}|s&|S|��}|s/|jn|j}	|�	|�
||��z|��}Wn
tyLY|Sw|j}q3)NzHCycle in the exception chain detected: exception '%s' encountered again.)r0r�r��warnings�warnr�popr1�
__traceback__�extend�get_exception_traceback_framesr�)r�
exceptionsr0r�r1rrrr��s:

�����z&ExceptionReporter.get_traceback_framesccs�|�|�}t|dd�}|dur||ddd�V|dur�|jj�d�r'|j}q|jjj}|jjj}|j	d}|jj
�d�}|jj
�d�pEd	}	|�||d
||	�\}
}}}
|
dur_|}
g}d}g}
||||	�d�rid
nd|||d|j
�|j|j�t|�|||
|
dd�
V|j}|dusdSdS)Nr�Tr�)�	exc_cause�exc_cause_explicitr1�type�__traceback_hide__r��
__loader__rrM�z<source code not available>zdjango.r�)
r�r�r1rr��functionr�r��idr�r�r��pre_context_lineno)r�r:r~r}�get�tb_nextr{�co_filenamer|�	tb_lineno�	f_globalsr��
startswithr�r�r.r)rr0r1r�r�r�rr�r�r�rr�r�r�rrrr��sT�
�



���z0ExceptionReporter.get_exception_traceback_frames)F)NN)rrrr%�propertyr�r�r r�r,r-r�r�r�r�r�rrrrr��s


H
"!r�cCsz	|jdd}Wntttfy|jdd�}Ynwz	|jdd}Wntttfy=d}|jr9|jjnd}Yn;wd}|rt|jdkrxt|�dkrxt|d�dkrxt	|ddd	d
�t	|dddd
�krrdkrxt
|�Snt
|�St	|d
tj�}t
|tj�r�|j}d
}zt|j�}Wn	ty�Yn*w|j}t|d�r�|j}nt|d�r�t|jd�r�|jj}t|d�r�|j}	d|	|f}ttdd�jdd��}
t�|
���}Wd�n1s�wYt�}t|tj|||t|�||� �|d�	�}
t!|�"|
�dd�S)zBCreate a technical 404 error response. `exception` is the Http404.rr�r�N�triedTF�/�app_namerM�	namespace�admin�urlconfr�	__class__rz%s.%sr�ztechnical_404.htmlr�r�)	r�root_urlconf�request_path�urlpatterns�resolved�reasonr.r�raising_view_namer'�r))#r�r�rS�KeyError�	path_info�resolver_matchrr�r�r:�default_urlconfr�ROOT_URLCONFrU�types�
ModuleTyperrr�funcrdrrrr�r�r�r�r�r8rr�rbrr�)r.�	exception�	error_urlrrr�callerr�obj�moduler�r��reporter_filterr�rrr�technical_404_response�sj��
2��

��r*cCsbttdd�jdd��}t�|���}Wd�n1swYtdt�i�}t|�	|�dd�S)	z+Create an empty URLconf 404 error response.r�zdefault_urlconf.htmlr�r�N�versionr'r)
rr�r�r�r�r�rrrr�)r.r�r�r�rrrr(s��r)r&)1�	functoolsr�r�r!r��pathlibr�django.confr�django.httprrr�django.templaterrr	�django.template.defaultfiltersr
�django.urlsr�django.utilsr�django.utils.datastructuresr
�django.utils.encodingr�django.utils.module_loadingr�django.utils.regex_helperr�django.utils.versionrr��__file__�parentr��UserWarningrrr6�	lru_cacher8r<r*r@r�r*rrrrr�<module>sF�


'w<

https://t.me/RX1948 - 2025