
    tni                         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 n# e$ r  ed          w xY w G d	 d
e          ZdS )    N)Integration)SentryWsgiMiddleware)ensure_integration_enabledevent_from_exception)DidNotEnable)TrytonException)appzTrytond is not installed.c                   <    e Zd ZdZde ZddZedd            ZdS )TrytondWSGIIntegrationtrytond_wsgiz
auto.http.returnNc                     d S N )selfs    \/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/integrations/trytond.py__init__zTrytondWSGIIntegration.__init__   s        c                  N   t          t          j        t          j                  t          _        t          t                    dt          dd fd            t          t          d          rt          j        fd            } d S t          j	        
                               d S )N)span_originer   c                     t          | t                    rd S t          j                    }t	          | |j        ddd          \  }}t          j        ||           d S )NtrytondF)typehandled)client_options	mechanism)hint)
isinstancer   
sentry_sdk
get_clientr   optionscapture_event)r   clienteventr   s       r   error_handlerz8TrytondWSGIIntegration.setup_once.<locals>.error_handler   sp    !_-- 	;#.002#)>'0UCC  t
 (T::::::r   r&   c                      |           d S r   r   )r	   requestr   r&   s      r   _z,TrytondWSGIIntegration.setup_once.<locals>._0   s    a     r   )r   r	   wsgi_appr   originr   	Exceptionhasattrr&   error_handlersappend)r)   r&   s    @r   
setup_oncez!TrytondWSGIIntegration.setup_once   s    +L.5
 
 

 
$$:	;	;
	;Y 
	;4 
	; 
	; 
	; 
<	;
	; 3(( 	5! ! ! ! ! ! ! %%m44444r   )r   N)__name__
__module____qualname__
identifierr+   r   staticmethodr0   r   r   r   r   r      sZ        J&*&&F    5 5 5 \5 5 5r   r   )r    sentry_sdk.integrationsr   sentry_sdk.integrations.wsgir   sentry_sdk.utilsr   r   r   trytond.exceptionsr   trytond.wsgir	   ImportErrorr   r   r   r   <module>r<      s        / / / / / / = = = = = = M M M M M M M M 0 0 0 0 0 04222222        4 4 4
,2
3
334%5 %5 %5 %5 %5[ %5 %5 %5 %5 %5s   - >