o
    hs                     @   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 )TrytondWSGIIntegrationtrytond_wsgiz
auto.http.c                 C   s   d S N )selfr   r   a/var/www/html/pro-man-master/venv/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)span_originc                 S   sB   t | trd S t }t| |jdddd\}}tj||d d S )NtrytondF)typehandled)client_options	mechanism)hint)
isinstancer   
sentry_sdk
get_clientr   options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   wsgi_appr   originr   hasattrr   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   sentry_sdk.integrationsr   sentry_sdk.integrations.wsgir   sentry_sdk.utilsr   r   trytond.exceptionsr   trytond.wsgir   r   r   r   r   r   <module>   s    