
    7 f+                         d dl Z d dlZd dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ  G d d	e          Zd
 Zed             Zed             Zd Zed             Z e            d             ZdS )    N)	AppConfig)settings)Warningregister)GZipMiddleware)import_string)gettext_lazyc                   .    e Zd ZdZ ed          Zd ZdS )DebugToolbarConfigdebug_toolbarzDebug Toolbarc                 h    ddl m} |                                D ]}|                                 d S )Nr   DebugToolbar)debug_toolbar.toolbarr   get_panel_classesready)selfr   clss      H/var/www/equiseq/venv/lib/python3.11/site-packages/debug_toolbar/apps.pyr   zDebugToolbarConfig.ready   sJ    666666  1133 	 	CIIKKKK	 	    N)__name__
__module____qualname__name_verbose_namer    r   r   r   r      s7        D1_%%L    r   r   c                     fd|                      dd          }|                      di                                dd          }|rt           |                    }|du pd|v }|p|S )a  
    Checks if a template configuration is valid.

    The toolbar requires either the toolbars to be unspecified or
    ``django.template.loaders.app_directories.Loader`` to be
    included in the loaders.
    If custom loaders are specified, then APP_DIRS must be True.
    c              3      K   | D ]=}t          |t                    r"|d         V   |d                   E d{V  9|V  >dS )z
        Recursively flatten the settings list of template loaders.

        Check for (loader, [child_loaders]) tuples.
        Django's default cached loader uses this pattern.
        r      N)
isinstancetuple)loadersloaderflat_loaderss     r   r%   z+check_template_config.<locals>.flat_loaders%   su        	 	F&%(( Qi'<q	2222222222	 	r   APP_DIRSFOPTIONSr#   Nz.django.template.loaders.app_directories.Loader)getlist)configapp_dirsr#   has_app_loadersr%   s       @r   check_template_configr-      s         zz*e,,HjjB''++It<<G .||G,,-- 	4VKwV  &h&r   c                    ddl m} g }d }g }t          d t          j        D                       r%|                    t          ddd                     t          j        d          r'|                    t          d	d
d                     |S t          t          j	                  D ]B\  }}t          t          |          r|}t          ||          r|                    |           C|s&|                    t          ddd                     nlt          |          dk    r&|                    t          ddd                     n3|1|d         |k     r%|                    t          ddd                     |S )Nr   )DebugToolbarMiddlewarec              3   6   K   | ]}t          |           V  d S N)r-   ).0r*   s     r   	<genexpr>z#check_middleware.<locals>.<genexpr>G   s.      
N
N$V,,,
N
N
N
N
N
Nr   zAt least one DjangoTemplates TEMPLATES configuration needs to use django.template.loaders.app_directories.Loader or have APP_DIRS set to True.zInclude django.template.loaders.app_directories.Loader in ["OPTIONS"]["loaders"]. Alternatively use APP_DIRS=True for at least one django.template.backends.django.DjangoTemplates backend configuration.zdebug_toolbar.W006hintidMIDDLEWARE_CLASSESz>debug_toolbar is incompatible with MIDDLEWARE_CLASSES setting.z,Use MIDDLEWARE instead of MIDDLEWARE_CLASSESzdebug_toolbar.W004zKdebug_toolbar.middleware.DebugToolbarMiddleware is missing from MIDDLEWARE.zBAdd debug_toolbar.middleware.DebugToolbarMiddleware to MIDDLEWARE.zdebug_toolbar.W001r    zTdebug_toolbar.middleware.DebugToolbarMiddleware occurs multiple times in MIDDLEWARE.zMLoad debug_toolbar.middleware.DebugToolbarMiddleware only once in MIDDLEWARE.zdebug_toolbar.W002zrdebug_toolbar.middleware.DebugToolbarMiddleware occurs before django.middleware.gzip.GZipMiddleware in MIDDLEWARE.zrMove debug_toolbar.middleware.DebugToolbarMiddleware to after django.middleware.gzip.GZipMiddleware in MIDDLEWARE.zdebug_toolbar.W003)debug_toolbar.middlewarer/   allr   	TEMPLATESappendr   is_overridden	enumerate
MIDDLEWAREis_middleware_classr   len)app_configskwargsr/   errors
gzip_indexdebug_toolbar_indexesi
middlewares           r   check_middlewarerH   ?   s   ??????FJ

N
N8;M
N
N
NNN 
-- (  	
 	
 	
" 233 PC'  	
 	
 	
  #8#677 , ,:~z:: 	,JJ !7DD 	,!((+++   
#'  	
 	
 	
 	
 
"	#	#q	(	(0&'  	
 	
 	
 	
 
	$9!$<z$I$IGM'  	
 	
 	
 Mr   c                     ddl m} g }|                                D ].}|                                D ]}|                    |           /|S )zOAllow each panel to check the toolbar's integration for their its own purposes.r   r   )r   r   r   
run_checksr;   )rA   rB   r   rC   panel_classcheck_messages         r   check_panel_configsrM      sp     322222F#5577 ) )(3355 	) 	)MMM-((((	)Mr   c                     	 t          |          }n# t          $ r Y d S w xY wt          j        |          ot	          ||           S r1   )r   ImportErrorinspectisclass
issubclass)middleware_classmiddleware_pathmiddleware_clss      r   r?   r?      sa    &77   ?>** z(0 0 s    
  c                 ~    g }t          j                    }|s%|                    t          ddd                     |S )Nz&Setting DEBUG_TOOLBAR_PANELS is empty.zASet DEBUG_TOOLBAR_PANELS to a non-empty list in your settings.py.zdebug_toolbar.W005r4   )dt_settings
get_panelsr;   r   )rA   rB   rC   panelss       r   check_panelsrZ      sW    F#%%F 
8'	  	
 	
 	
 Mr   c                     ddh}t          t          j        d                                        |           }|rt	          ddd          gS g S )zP
    Check that JavaScript files are resolving to the correct content type.
    zapplication/javascriptztext/javascriptz
toolbar.jsz9JavaScript files are resolving to the wrong content type.a  The Django Debug Toolbar may not load properly while mimetypes are misconfigured. See the Django documentation for an explanation of why this occurs.
https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#static-file-development-view

This typically occurs on Windows machines. The suggested solution is to modify HKEY_CLASSES_ROOT in the registry to specify the content type for JavaScript files.

[HKEY_CLASSES_ROOT\.js]
"Content Type"="application/javascript"zdebug_toolbar.W007r4   )set	mimetypes
guess_typeintersectionr   )rA   rB   javascript_typescheck_faileds       r   js_mimetype_checkrb      sz     12CD9/==>>KK  L  
K	: (  
 	
  Ir   )rP   r]   django.appsr   django.confr   django.core.checksr   r   django.middleware.gzipr   django.utils.module_loadingr   django.utils.translationr	   r   r   rW   r   r-   rH   rM   r?   rZ   rb   r   r   r   <module>ri      sg        ! ! ! ! ! !             0 0 0 0 0 0 0 0 1 1 1 1 1 1 5 5 5 5 5 5 6 6 6 6 6 6 1 1 1 1 1 1
 
 
 
 
 
 
 
!' !' !'H 
K K 
K\ 
  
   
  
 
    r   