o
    >h                     @   sP   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 Zdd	 ZdS )
    N)iscoroutinefunctionHttp404)get_languageoverride)settingsc                    sL   ddl m  trt fdd}|S t fdd}|S )zw
    Async compatible decorator to restrict access to a view
    based on the Debug Toolbar's visibility settings.
    r   )get_show_toolbarc                    s:    dd}|| I d H st | g|R i |I d H S )NT
async_moder   requestargskwargsshow_toolbarr   view x/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/debug_toolbar/decorators.pyinner   s
   
z#require_show_toolbar.<locals>.innerc                    s,    dd}|| st | g|R i |S )NFr	   r   r   r   r   r   r      s   
)debug_toolbar.middlewarer   r   	functoolswrapsr   r   r   r   r   require_show_toolbar
   s   r   c                    s   t   fdd}|S )zBForce any rendering within the view to use the toolbar's language.c                    sT   t  d pt }t|  | g|R i |W  d    S 1 s#w   Y  d S )NTOOLBAR_LANGUAGE)dt_settings
get_configr   language_override)r   r   r   langr   r   r   r   *   s   
$z+render_with_toolbar_language.<locals>.inner)r   r   r   r   r   r   render_with_toolbar_language'   s   r    )r   asgiref.syncr   django.httpr   django.utils.translationr   r   r   debug_toolbarr   r   r   r    r   r   r   r   <module>   s    