o
    ¹iR  ã                   @   sZ   d Z ddlZddlmZ ddlmZ ddlmZ dZG dd	„ d	eƒZ	d
Z
de
 e	fgZdS )z-Tornado handlers for frontend config storage.é    N)Úweb)Ú
authorizedé   )Ú
APIHandlerÚconfigc                   @   sJ   e Zd ZdZeZejedd„ ƒƒZ	ejedd„ ƒƒZ
ejedd„ ƒƒZdS )	ÚConfigHandlerzA config API handler.c                 C   s(   |   dd¡ |  t | j |¡¡¡ dS )zGet config by section name.zContent-Typezapplication/jsonN)Ú
set_headerÚfinishÚjsonÚdumpsÚconfig_managerÚget)ÚselfÚsection_name© r   úb/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jupyter_server/services/config/handlers.pyr      s   zConfigHandler.getc                 C   s$   |   ¡ }| j ||¡ |  d¡ dS )zSet a config section by name.éÌ   N)Úget_json_bodyr   ÚsetÚ
set_status)r   r   Údatar   r   r   Úput   s   zConfigHandler.putc                 C   s*   |   ¡ }| j ||¡}|  t |¡¡ dS )z Update a config section by name.N)r   r   Úupdater	   r
   r   )r   r   Únew_dataÚsectionr   r   r   Úpatch#   s   zConfigHandler.patchN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚAUTH_RESOURCEÚauth_resourcer   Úauthenticatedr   r   r   r   r   r   r   r   r      s    r   z(?P<section_name>\w+)z/api/config/%s)r   r
   Útornador   Újupyter_server.authr   Úbase.handlersr   r    r   Úsection_name_regexÚdefault_handlersr   r   r   r   Ú<module>   s    
ÿ