o
    0 is                     @   s\   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 G dd deZdS )	    N)Integration)SentryWsgiMiddleware)ensure_integration_enabledevent_from_exception)TrytonException)appc                   @   s.   e Zd ZdZde Zdd Zedd ZdS )TrytondWSGIIntegrationZtrytond_wsgiz
auto.http.c                 C   s   d S N )selfr
   r
   k/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/sentry_sdk/integrations/trytond.py__init__   s   zTrytondWSGIIntegration.__init__c                     sR   t tjtjdt_ttdd  ttdr!tj fdd} d S tj	  d S )N)Zspan_originc                 S   sB   t | trd S t }t| |jdddd\}}tj||d d S )NZtrytondF)typeZhandled)Zclient_optionsZ	mechanism)hint)
isinstancer   
sentry_sdkZ
get_clientr   optionsZcapture_event)eclienteventr   r
   r
   r   error_handler   s   

z8TrytondWSGIIntegration.setup_once.<locals>.error_handlerr   c                    s    | d S r	   r
   )r   requestr   r   r
   r   _-   s   z,TrytondWSGIIntegration.setup_once.<locals>._)
r   r   Zwsgi_appr   originr   hasattrr   Zerror_handlersappend)r   r
   r   r   
setup_once   s   

z!TrytondWSGIIntegration.setup_onceN)__name__
__module____qualname__
identifierr   r   staticmethodr   r
   r
   r
   r   r      s    
r   )r   Zsentry_sdk.integrationsr   Zsentry_sdk.integrations.wsgir   Zsentry_sdk.utilsr   r   Ztrytond.exceptionsr   Ztrytond.wsgir   r   r
   r
   r
   r   <module>   s    