
    \j                         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  G d	 d
e      Zy# e$ r	  ed      w xY w)    N)Integration)SentryWsgiMiddleware)ensure_integration_enabledevent_from_exception)DidNotEnable)TrytonException)appzTrytond is not installed.c                   4    e Zd ZdZde ZddZedd       Zy)TrytondWSGIIntegrationtrytond_wsgiz
auto.http.Nc                      y N )selfs    I/root/env/lib/python3.12/site-packages/sentry_sdk/integrations/trytond.py__init__zTrytondWSGIIntegration.__init__   s        c                  6   t        t        j                  t        j                        t        _        t        t              dt        dd fd       t        t        d      rt        j                  fd       } y t        j                  j                         y )N)span_originereturnc                     t        | t              ry t        j                         }t	        | |j
                  ddd      \  }}t        j                  ||       y )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   sO    !_-#..02#)>>'0UCt
 ((T:r   r&   c                      |       y 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    +LL.55

 
$$:	;
	;Y 
	;4 
	; 
<
	; 3(! ! %%m4r   )r   N)__name__
__module____qualname__
identifierr+   r   staticmethodr0   r   r   r   r   r      s,    J*&F 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<      sH     / = M 042 %5[ %5  4
2
334s	   8 A