
    k"g5                     "   d dl Z d dlmZ d dlmZ d dlmZ ddlmZm	Z	m
Z
mZ  ee	j                        d        Zd Z ee	j                        d	        Zdd
Zd Z ee	j                        d        Zd Z ee	j                        d        Zy)    N)Counter)settings)ViewDoesNotExist   )ErrorTagsWarningregisterc                 X    t        t        dd       rddlm}  |       }t	        |      S g S )NROOT_URLCONFr   get_resolver)getattrr   django.urlsr   check_resolver)app_configskwargsr   resolvers       P/var/www/html/djangosite/lib/python3.12/site-packages/django/core/checks/urls.pycheck_url_configr   
   s(    x.,>h''I    c                 `    t        | dd      }| |       S t        | d      st        |       S g S )z)
    Recursively check the resolver.
    checkNresolve)r   hasattrget_warning_for_invalid_pattern)r   check_methods     r   r   r      s:     8Wd3L~Xy).x88	r   c                 6   t        t        dd      sg S ddlm}  |       }t	        |      }t        |      }|j                         D cg c]  \  }}|dkD  s| }}}g }	|D ]-  }
|	j                  t        dj                  |
      d             / |	S c c}}w )	zD
    Warn if URL namespaces used in applications aren't unique.
    r   Nr   r   r   zZURL namespace '{}' isn't unique. You may not be able to reverse all URLs in this namespacez	urls.W005id)
r   r   r   r   _load_all_namespacesr   itemsappendr	   format)r   r   r   r   all_namespacescounterncountnon_unique_namespaceserrors	namespaces              r   check_url_namespaces_uniquer,   !   s    
 8^T2	(~H)(3Nn%G/6}}L81e%!)QLLF* 
	--3VI->	

 M Ms   
BBc                    t        | dg       }|D cg c].  }t        |dd      dj                  ||j                  fz         0 }}|D ]4  }t        |dd      }|}|||fz  }|j                  t	        ||             6 |S c c}w )z<
    Recursively load all namespaces from URL patterns.
    url_patternsr+   N:)r   joinr+   extendr!   )r   parentsr.   url
namespacespatternr+   currents           r   r!   r!   ;   s     8^R8L  3T*6 	CMM++,J 
   BG[$7	 	|#G.w@AB s   3Bc                     t        | t              rdj                  |       }nt        | t              rd}nd}t	        dj                  |       |d      gS )z
    Return a list containing a warning that the pattern is invalid.

    describe_pattern() cannot be used here, because we cannot rely on the
    urlpattern having regex or name attributes.
    zkTry removing the string '{}'. The list of urlpatterns should not have a prefix string as the first element.z$Try using path() instead of a tuple.NziYour URL pattern {!r} is invalid. Ensure that urlpatterns is a list of path() and/or re_path() instances.z	urls.E004hintr    )
isinstancestrr$   tupler   )r5   r9   s     r   r   r   N   s_     '399? 	 
GU	#5 	44:F7O		
 r   c                     g }dD ]A  }t        t        |      }|s|j                  d      r(|j                  t	        |             C |S )N)
STATIC_URL	MEDIA_URL/)r   r   endswithr#   E006)r   r   r*   namevalues        r   check_url_settingsrE   i   sG    F+ &$',MM$t*%& Mr   c                 :    t        dj                  |       d      S )Nz%The {} setting must end with a slash.z	urls.E006r   )r   r$   )rC   s    r   rB   rB   s   s     /66t< r   c           
      v   t        t        dd       sg S ddlm}  |       }g }dD ]B  \  }}	 |j	                  |      }t        j                  |      }d g|z  }	  |j                  |  D |S # t
        t        f$ r\}t        |j                  d|z        }	dj                  ||	      }
|j                  t        |
t        |      d	             Y d }~d }~ww xY w# t        $ rU d
j                  ||j                   dz   |j"                  z   |dk(  rdnd      }
|j                  t        |
d             Y w xY w)Nr   r   r   ))i     )i  rH   )i  rH   )i  r   z	handler%szDThe custom handler{status_code} view '{path}' could not be imported.)status_codepathz	urls.E008r8   zeThe custom handler{status_code} view '{path}' does not take the correct number of arguments ({args})..rH   zrequest, exceptionrequest)rI   rJ   argsz	urls.E007r   )r   r   r   r   resolve_error_handlerImportErrorr   urlconf_moduler$   r#   r   r;   inspect	signaturebind	TypeError
__module____qualname__)r   r   r   r   r*   rI   num_parametershandlererJ   msgrR   rM   s                r   check_custom_error_handlersr[   z   sS   8^T2	(~HF (P 6#^		44[AG %%g.	v&	6INND!62 M- -. 	822K+4MNDf4f8  MM%#a&[AB	  		6Af'''#-0D0DD-;q-@)i    MM%45		6s+   A,C,C;ACCAD87D8) )rQ   collectionsr   django.confr   django.core.exceptionsr    r   r   r	   r
   urlsr   r   r,   r!   r   rE   rB   r[   r\   r   r   <module>rb      s        3 , , 
$)) 
 
$)) 2&6 
$))  
$))$ $r   