
    MȂi1e                        S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
  S SKJrJrJr  S SKJrJrJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJ r   S SK!J"r"  S SK#J$r$J%r%  S SK&J'r'  \" SSS0S9r(S r) " S S\*5      r+ " S S5      r,\$" 0 5      \%" 0 5      S$S j5       5       r-\ R\                  S 5       r/S r0S r1S r2 " S S5      r3 " S  S!5      r4\$" 0 5      \%" 0 5      S" 5       5       r5S# r6g)%    N)Path)settings)Http404HttpResponseHttpResponseNotFound)ContextEngineTemplateDoesNotExist)pprint)resolve)timezone)MultiValueDict)	force_str)import_string)_lazy_re_compile)get_docs_version)csp_overridecsp_report_only_override)*coroutine_functions_to_sensitive_variablesTi18nzdjango.templatetags.i18n)debug	librariesc                 @    [        [        5      R                  S-  U -  $ )z
Return a path to a builtin template.

Avoid calling this function at the module level or in a class-definition
because __file__ may not exist, e.g. in frozen environments.
	templates)r   __file__parent)names    CD:\sksbv-state-backend\venv\Lib\site-packages\django/views/debug.pybuiltin_template_pathr   "   s     >  ;.55    c                       \ rS rSrSrg)ExceptionCycleWarning,    N)__name__
__module____qualname____firstlineno____static_attributes__r$   r    r   r"   r"   ,   s    r    r"   c                   $    \ rS rSrSrS rS rSrg)CallableSettingWrapper0   z
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).
c                     Xl         g N_wrapped)selfcallable_settings     r   __init__CallableSettingWrapper.__init__8   s    (r    c                 ,    [        U R                  5      $ r.   )reprr0   r1   s    r   __repr__CallableSettingWrapper.__repr__;   s    DMM""r    r/   N)r%   r&   r'   r(   __doc__r3   r8   r)   r$   r    r   r+   r+   0   s    )#r    r+   c                     [        U 5      " XX#5      nU R                  SS/5      nUS:X  a  UR                  5       n[        XtSS9$ UR	                  5       n[        XSS9$ )z}
Create a technical server error response. The last three arguments are
the values returned from sys.exc_info() and friends.
z	text/htmlz
text/plain)statuscontent_typeztext/plain; charset=utf-8)get_exception_reporter_classget_preferred_typeget_traceback_htmlr   get_traceback_text)	requestexc_type	exc_valuetbstatus_codereporterpreferred_typehtmltexts	            r   technical_500_responserK   ?   sn     ,G4W	VH//l0KLN$**,D;OO**,3N
 	
r    c                  >    [        [        R                  5      " 5       $ r.   )r   r   !DEFAULT_EXCEPTION_REPORTER_FILTERr$   r    r   %get_default_exception_reporter_filterrN   R   s     CCDFFr    c                 0    [        5       n[        U SU5      $ )Nexception_reporter_filter)rN   getattr)rB   default_filters     r   get_exception_reporter_filterrS   X   s    :<N77HHr    c                 N    [        [        R                  5      n[        U SU5      $ )Nexception_reporter_class)r   r   DEFAULT_EXCEPTION_REPORTERrQ   )rB    default_exception_reporter_classs     r   r>   r>   ]   s.    '4++($ +-M r    c                     U R                   nUc   [        U R                  5      nUc  S$ UR                  $ ! [         a     Nf = f)N )resolver_matchr   pathr   
_func_path)rB   rZ   s     r   
get_callerr]   f   sR    ++N	$W\\2N  '2F^-F-FF  		s   7 
AAc                   t    \ rS rSrSrSr\" S\R                  S9r	S r
S rS rS	 rS
 rS rS rS rS rSrg)SafeExceptionReporterFilterp   z
Use annotations made by the sensitive_post_parameters and
sensitive_variables decorators to filter out sensitive information.
z********************z4API|AUTH|TOKEN|KEY|SECRET|PASS|SIGNATURE|HTTP_COOKIE)flagsc           	         U[         R                  :X  a  SnO U R                  R                  U5      nU(       a  U R
                  nO[        U[        5      (       a3  UR                  5        VVs0 sH  u  pVXPR                  XV5      _M     nnnOx[        U[        5      (       a!  U Vs/ sH  o`R                  SU5      PM     nnOB[        U[        5      (       a+  [        U Vs/ sH  o`R                  SU5      PM     sn5      nOUn[        U5      (       a  [        U5      nU$ ! [         a    Sn Nf = fs  snnf s  snf s  snf )z
Cleanse an individual setting key/value of sensitive content. If the
value is a dictionary, recursively cleanse the keys in that dictionary.
TFrY   )r   SESSION_COOKIE_NAMEhidden_settingssearch	TypeErrorcleansed_substitute
isinstancedictitemscleanse_settinglisttuplecallabler+   )r1   keyvalueis_sensitivecleansedkvs          r   rk   +SafeExceptionReporterFilter.cleanse_setting{   s   
 (...L%#33::3? //Ht$$BG++-P-$!//55-HPHt$$=BCU,,R3UHCHu%%5I5a222q95IJHHH-h7H#  %$% QCIs#   D% 0D7)D=$E%D43D4c                     0 n[        [        5       H<  nUR                  5       (       d  M  U R                  U[	        [        U5      5      X'   M>     U$ )zo
Return a dictionary of the settings module with values of sensitive
settings replaced with stars (*********).
)dirr   isupperrk   rQ   )r1   settings_dictrs   s      r   get_safe_settings-SafeExceptionReporterFilter.get_safe_settings   sF    
 XAyy{{#'#7#778Q;O#P   r    c           	          [        US5      (       d  0 $ UR                  R                  5        VVs0 sH  u  p#X R                  X#5      _M     snn$ s  snnf )zE
Return a dictionary of request.META with sensitive values redacted.
META)hasattrr}   rj   rk   r1   rB   rs   rt   s       r   get_safe_request_meta1SafeExceptionReporterFilter.get_safe_request_meta   sM     w''I:A,,:L:L:NO:N$!''--:NOOO   Ac           	          [        US5      (       d  0 $ UR                  R                  5        VVs0 sH  u  p#X R                  X#5      _M     snn$ s  snnf )zH
Return a dictionary of request.COOKIES with sensitive values redacted.
COOKIES)r~   r   rj   rk   r   s       r   get_safe_cookies,SafeExceptionReporterFilter.get_safe_cookies   sM     w	**I:A//:O:O:QR:Q$!''--:QRRRr   c                 &    [         R                  SL $ )z
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   DEBUG)r1   rB   s     r   	is_active%SafeExceptionReporterFilter.is_active   s     ~~&&r    c                     [        US/ 5      nU R                  U5      (       a5  U(       a.  UR                  5       nU H  nXB;   d  M
  U R                  X$'   M     U$ )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)rQ   r   copyrg   )r1   rB   multivaluedictr   params        r   get_cleansed_multivaluedict7SafeExceptionReporterFilter.get_cleansed_multivaluedict   s[     %,G5PRT$U!>>'""'@+002N2*,0,D,DN) 3 r    c                 *   Uc  0 $ [        US/ 5      nU R                  U5      (       a`  U(       aY  UR                  R                  5       nUS:X  a  U H  nU R                  X4'   M     U$ U H  nXS;   d  M
  U R                  X5'   M     U$ UR                  $ )zS
Replace the values of POST parameters marked as sensitive with
stars (*********).
r   __ALL__)rQ   r   POSTr   rg   )r1   rB   r   rr   rs   r   s         r   get_post_parameters/SafeExceptionReporterFilter.get_post_parameters   s    
 ?I(/4b)% ~~g&&+D"<<,,.,	9%&*&>&> &#O "; ,.2.F.FHO "; $O||#r    c                      [        U[        5      nU(       a  U R	                  X5      nU$ ! [         a  nSR                  XB5      s S nA$ S nAff = f)Nz{!r} while evaluating {!r})rh   r   	Exceptionformatr   )r1   rB   rp   is_multivalue_dictes        r   cleanse_special_types1SafeExceptionReporterFilter.cleanse_special_types   sX    	A ",E>!B  44WDE  	A/66q@@	As   , 
AAAAc                 .   SnUR                   R                  [        R                  -  S:w  ai  UR                   R                  S:w  aO  [        UR                   R                   SUR                   R                   35      n[        R                  " US5      nUc]  UnUbX  UR                   R                  S:X  a-  SUR                  ;   a  UR                  S   n[        USS5      nOUR                  nUb  MX  0 nU R                  U5      (       az  U(       as  US:X  a"  UR                   H  nU R                  Xx'   M     OUR                  R                  5        H,  u  pX;   a  U R                  n	OU R!                  X5      n	XU'   M.     O6UR                  R                  5        H  u  pU R!                  X5      Xx'   M     UR                   R                  S:X  a.  SUR                  ;   a  U R                  US'   U R                  US'   UR                  5       $ )	zM
Replace the values of variables marked as sensitive with
stars (*********).
Nr   sensitive_variables_wrapper:sensitive_variablesr   	func_argsfunc_kwargs)f_codeco_flagsinspectCO_COROUTINEco_namehashco_filenameco_firstlinenor   getf_localsrQ   f_backr   rg   rj   r   )
r1   rB   tb_framer   ro   current_framewrapperrr   r   rp   s
             r   get_traceback_frame_variables9SafeExceptionReporterFilter.get_traceback_frame_variables   s   
 # OO$$w';';;q@''+HH??../q1O1O0PQC #M"P"PT# & %M+!((004QQ59O9OO ,445RSG*1';PRV*W' - 4 4  + >>'""':"i/$--D%)%=%=HN . $,#4#4#:#:#<KD2 $ 8 8 $ : :7 J%*TN $=  (00668!%!;!;G!K  9 OO##'DD-1B1BB %)$<$<H[!&*&>&>H]#~~r    r$   N)r%   r&   r'   r(   r:   rg   r   reIrd   rk   rz   r   r   r   r   r   r   r   r)   r$   r    r   r_   r_   p   sR    
 1&>bddO:	PS'$6D r    r_   c                   ~    \ rS rSrSr\S 5       r\S 5       rSS jrS r	S r
S rS	 rS
 r SS jrS rS rS rSrg)ExceptionReporteri;  z0Organize and coordinate reporting on exceptions.c                     [        S5      $ )Nztechnical_500.htmlr   r7   s    r   html_template_path$ExceptionReporter.html_template_path>  s    $%9::r    c                     [        S5      $ )Nztechnical_500.txtr   r7   s    r   text_template_path$ExceptionReporter.text_template_pathB  s    $%899r    c                     Xl         [        U R                   5      U l        X l        X0l        X@l        XPl        [        U R                  SS 5      U l        SU l	        S U l
        g )Ntemplate_debugF)rB   rS   filterrC   rD   rE   is_emailrQ   template_infotemplate_does_not_exist
postmortem)r1   rB   rC   rD   rE   r   s         r   r3   ExceptionReporter.__init__F  sP    3DLLA " $T^^5EtL',$r    c                     SR                  U R                  R                  U R                  R                  5       U R                  R	                  5       S9$ )z}
Return an absolute URI from variables available in this request. Skip
allowed hosts protection, so may return insecure URI.
z{scheme}://{host}{path})schemehostr[   )r   rB   r   _get_raw_hostget_full_pathr7   s    r   _get_raw_insecure_uri'ExceptionReporter._get_raw_insecure_uriR  sI    
 )//<<&&++-++- 0 
 	
r    c           
         U R                   (       aU  [        U R                   [        5      (       a6  SU l        U R                  R
                  =(       d    U R                  /U l        U R                  5       n[        U5       Hb  u  p#SU;   aS  / nUS    HD  u  pV[        U5      n[        U5      S:  a  SUSS [        U5      4-  nUR                  XV45        MF     XCS'   X1U'   Md     SnU R                   (       a  [        U R                   [        5      (       a~  [        U R                  SS5      n[        U R                  S	S5      n	UbM  U	bJ  U R                  R                  S
   n
[        U
[!        US-
  S5      [#        U	S-   [        U
5      5       SSS9nSSKJn  U R(                  c  SnO  [+        U R(                  R,                  5      n0 SU R0                  _SU_SU_SU R(                  _SU R2                  R5                  U R(                  5      _SU R2                  R7                  U R(                  5      R9                  5       _SU_S[;        U R2                  R=                  U R(                  5      R9                  5       5      _SU R2                  R?                  5       _S[@        RB                  _SS[@        RD                  SS -  _S[F        RH                  " 5       _SU" 5       _S [@        RJ                  _S!U RL                  _S"U R                  _S#U R                  _nU R(                  by  U R(                  RN                  R9                  5       US$'   U R(                  RP                  R9                  5       US%'   U RS                  5       US&'   [U        U R(                  5      US''   U R                   (       a  U R                   RV                  US('   U R                  (       aY  [        U R                  S)U R                  5      US*'   [        U R                  S+S5      =n(       a  S,S,RY                  U5      -   US-'   U(       a  US.   US/'   U$ ! [.         a    Sn GNf = f)0z5Return a dictionary containing traceback information.Tvarsi   u   %s… <trimmed %d bytes string>r   rY   startNend      asciireplace)errors)get_versionz%[unable to retrieve the current user]r   unicode_hintframesrB   request_metarequest_COOKIES_items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_insecure_uriraising_view_nameexception_typeraw_error_messageexception_value	__notes__
exception_notes	lastframe)-rC   
issubclassr
   r   rD   chainr   get_traceback_frames	enumerater   lenappendUnicodeErrorrQ   argsr   maxmindjangor   rB   struserr   r   r   r   r   rj   rl   r   rz   sys
executableversion_infor   nowr[   r   GETFILESr   r]   r%   join)r1   r   iframe
frame_varsrs   rt   r   r   r   unicode_strr   r   c	exc_notess                  r   get_traceback_data$ExceptionReporter.get_traceback_data]  s   ==Z7KLL+/D("nn22Ft~~6FDO**,!&)HA
!&MDAq	A1v}=1TCPQF@SS%%qf- * !+f1I * ==Z|DDDNNGT:E$..%6C S_"nn11!4(EAIq 1Ca[AQ4RS$ 
 	'<<HCt||001

L
 f
 t||	

 DKK==dllK
 $T[[%A%A$,,%O%U%U%W
 
 "4//=CCE$
 557
 cnn
 
S-=-=a-B B
 8<<>
 ";=
  !
" T//#
$ &t'C'C%
& $//'
* <<#%)\\%5%5%;%;%=A!"'+||'9'9'?'?'AA#$(,(B(B(DA$%%/%=A!" =="&--"8"8A>>#* 3T^^$A  $DNNKFFyF'+dii	.B'B#$#BZAkNW  C CCs   /Q QQc                     U R                   R                  SS9 n[        R                  UR	                  5       5      nSSS5        [        U R                  5       SS9nWR                  U5      $ ! , (       d  f       N7= f)z1Return HTML version of debug 500 HTTP error page.utf-8encodingNF)use_l10n)r   openDEBUG_ENGINEfrom_stringreadr   r
  renderr1   fhtr  s       r   r@   $ExceptionReporter.get_traceback_html  sb    $$))7);r((3A <D++->xx{ <;s   $A//
A=c                    U R                   R                  SS9 n[        R                  UR	                  5       5      nSSS5        [        U R                  5       SSS9nWR                  U5      $ ! , (       d  f       N8= f)z7Return plain text version of debug 500 HTTP error page.r  r  NF)
autoescaper  )r   r  r  r  r  r   r
  r  r  s       r   rA   $ExceptionReporter.get_traceback_text  sd    $$))7);r((3A <D++-%%Pxx{ <;s   $A00
A>c                 N   S n[        US5      (       a%   UR                  U5      nUb  UR                  5       nUc6   [	        US5       nUR                  5       R                  5       nS S S 5        U$ U$ ! [         a     NZf = f! , (       d  f       U$ = f! [         a     U$ f = f)N
get_sourcerb)r~   r  ImportError
splitlinesr  r  OSError)r1   filenameloadermodule_namesourcefps         r   _get_sourceExceptionReporter._get_source  s    6<((**;7 !**,>(D)RWWY113F * v   *)   s@   A4 B 	B(B 4
B B
BB B 
B$#B$Nc                    U R                  XU5      nUc  S/ S/ 4$ [        US   [        5      (       a]  SnUSS  H7  n[        R                  " SU5      n	U	(       d  M#  U	S   R                  S5      n  O   U V
s/ sH  n
[        XS5      PM     nn
[        SX#-
  5      nX#-   n XkU nXb   nXbS-   U nXX4$ s  sn
f ! [         a	    S/ S/ 4s $ f = f)z
Return context_lines before and after lineno from file.
Return (pre_context_lineno, pre_context, context_line, post_context).
Nr   r      s   coding[:=]\s*([-\w.]+)r   r   )	r(  rh   bytesr   re   decoder   r   
IndexError)r1   r#  linenocontext_linesr$  r%  r&  r  linematchslinelower_boundupper_boundpre_contextcontext_linepost_contexts                   r   _get_lines_from_file&ExceptionReporter._get_lines_from_file  s    !!(K@>T2%%
 fQi''Hr
 		"<dC5$Qxw7H # DJJ6%c%956FJ!V34,	& V4K!>L!1*{;L CC K  	&T2%%	&s   :B7$B< <CCc                 x    [        USS 5      n[        USS 5      n[        USS 5      nU=(       d    U(       a  S $ U$ )N	__cause____suppress_context____context__)rQ   )r1   rD   explicitsuppress_contextimplicits        r   _get_explicit_or_implicit_cause1ExceptionReporter._get_explicit_or_implicit_cause  sA    9k48"9.DdK9mT:C$4DC(Cr    c                    / nU R                   nU(       aO  UR                  U5        U R                  U5      nX!;   a  [        R                  " SU-  [
        5        O	U(       a  MO  / nU(       d  U$ UR                  5       nU(       d  U R                  OUR                  n UR                  U R                  X$5      5         UR                  5       nUR                  nM?  ! [         a     U$ f = f)NzHCycle in the exception chain detected: exception '%s' encountered again.)rD   r   rB  warningswarnr"   poprE   __traceback__extendget_exception_traceback_framesr.  )r1   
exceptionsrD   r   rE   s        r   r   &ExceptionReporter.get_traceback_frames  s    
NN	i(<<YGI&)+45)  i M NN$	&TWWI,C,CMM$==iLM&NN,	 ((B   s   C 
C-,C-c              #     #    U R                  U5      n[        USS5      nUc	  UUS SS.v   UGbE  UR                  R                  R	                  S5      (       a  UR
                  nM<  UR                  R                  R                  nUR                  R                  R                  nUR                  S-
  nUR                  R                  R	                  S5      nUR                  R                  R	                  S5      =(       d    S	n	U R                  UUS
UU	5      u  n
nnnU
c  Un
/ nSn/ nS	=p[        [        R                  " UR                  R                  R                  5       UR                   S-  S 5      5      u    nnnU(       ak  U(       ad  SUU-
  -  nSU[#        [%        US-   5      5      -   S-   -  nSU U 3nSSU-   [#        U5      [#        UR'                  5       5      -
  -
  -  nSU U 3nUUUU	R)                  S5      (       a  SOSUUUS-   U R*                  R-                  U R.                  UR                  5      [1        U5      UUUU
S-   UUS.v   UR
                  nUb  GMD  g g 7f)Nr<  Tr   )	exc_causeexc_cause_explicitrE   type__traceback_hide__r   
__loader__r%   rY      z<source code not available>r+  ^ r      zdjango.r   )rN  rO  rE   rP  r#  functionr/  r   idr6  r7  r8  pre_context_linenocolnotb_area_colno)rB  rQ   r   r   r   tb_nextr   r   r   	tb_lineno	f_globalsr9  next	itertoolsisliceco_positionstb_lastir   r   lstrip
startswithr   r   rB   rX  )r1   rD   rE   rN  rO  r#  rW  r/  r$  r%  rY  r6  r7  r8  rZ  r[  _start_column
end_column	underlinespacestb_area_spacess                         r   rJ  0ExceptionReporter.get_exception_traceback_frames  s    88C	$YTB:&&8	  n {{##''(<==ZZ{{))55H{{))11H\\A%F[[**..|<F++//33J?E2K ))" ")%+" <!$&&E-1  KK&&335r{{a7G.*Aq,

 
:#<=	s3vz?/C Ca GHVHYK0!$$L(9C@S@S@U<V(VW" #%^$4YK @&&8$/$:$:9$E$E6$$ 1*AALL"++ f* , ,&81&<!.# & B} ns   I0I75I7)	rC   rD   r   r   r   rB   rE   r   r   )F)NN)r%   r&   r'   r(   r:   propertyr   r   r3   r   r
  r@   rA   r(  r9  rB  r   rJ  r)   r$   r    r   r   r   ;  sk    :; ; : :
	
Pd$ IM"DHDBHr    r   c                 $    UR                   S   S   n UR                   S   S   nSnU(       ac  U R                  S:X  a^  [        U5      S:X  aO  [        US   5      S:X  a=  [        US   S   SS	5      [        US   S   S
S	5      s=:X  a  S:X  a  O  O[        U 5      $ [        U S[        R                  5      n[        U[        R                  5      (       a  UR                  n[!        S5      R#                  SS9 n[$        R'                  UR)                  5       5      nSSS5        [+        5       n[-        U[        R                  UUU[/        U5      U UR1                  5       [3        U 5      S.	5      n	[5        WR7                  U	5      5      $ ! [        [        [        4 a    U R                  SS n GNf = f! [        [        [        4 a/    SnU R                  (       a  U R                  R                  OSn GN_f = f! , (       d  f       N= f)zBCreate a technical 404 error response. `exception` is the Http404.r   r[   r   NtriedF/app_namerY   	namespaceadminTurlconfztechnical_404.htmlr  r  )	rt  root_urlconfrequest_pathurlpatternsresolvedreasonrB   r   r   )r   r.  rf   KeyError	path_infor   rQ   default_urlconfrZ   ro  r   ROOT_URLCONFrh   types
ModuleTyper%   r   r  r  r  r  rN   r   r   rz   r]   r   r  )
rB   	exception	error_urlro  rx  rt  r  r  reporter_filterr  s
             r   technical_404_responser  d  s   *NN1%f-	,q!'*
 $E
aE!H"aZ4uQx{K4 #7++gy(*?*?@G'5++,,""	3	4	9	97	9	Kr$$RWWY/ 
L;=O$11%  )n'99;!+G!4
	
	A  ,,Q 	8, *%%ab)	*
 	8, Q070F0F&&,,DQ& 
L	Ks/   F F: <$H$F76F7:A G>=G>
Hc                 
   [        S5      R                  SS9 n[        R                  UR	                  5       5      nSSS5        [        S[        5       05      n[        WR                  U5      5      $ ! , (       d  f       N== f)z+Create an empty URLconf 404 error response.zdefault_urlconf.htmlr  r  Nversion)	r   r  r  r  r  r   r   r   r  )rB   r  r  r  s       r   r|  r|    so    	5	6	;	;W	;	MQS$$RWWY/ 
N')	
	A $$ 
N	Ms   $A44
B)i  )7	functoolsr   r`  r   r   r~  rE  pathlibr   django.confr   django.httpr   r   r   django.templater   r	   r
   django.template.defaultfiltersr   django.urlsr   django.utilsr   django.utils.datastructuresr   django.utils.encodingr   django.utils.module_loadingr   django.utils.regex_helperr   django.utils.versionr   django.views.decorators.cspr   r   django.views.decorators.debugr   r  r   UserWarningr"   r+   rK   	lru_cacherN   rS   r>   r]   r_   r   r  r|  r$   r    r   <module>r     s      	 
      C C A A 1  ! 6 + 5 6 1 N T 
126	K 	# # b"
  
" G G
I
GH  H Vf fR	 b",-  ,-^
%r    