Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/middleware.cpython-37.pyc

B

��Y
�@spdZddlmZddlmZddlmZmZddlm	Z	m
Z
mZedd��ZGdd	�d	e�Z
Gd
d�de�ZdS)
z�
raven.middleware
~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_import)�contextmanager)�Iterator�next)�get_current_url�get_headers�get_environc
cs�y
dVWn�ttfk
r$�Ynttk
rB|�|��YnVtk
r`|�|��Yn8tk
r�}z|jdkr�|�|��Wdd}~XYnXdS)Nr)�
StopIteration�
GeneratorExit�	Exception�handle_exception�KeyboardInterrupt�
SystemExit�code)�environ�client�e�r�A/opt/alt/python37/lib/python3.7/site-packages/raven/middleware.py�common_exception_handlings




rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ClosingIteratorz[
    An iterator that is implements a ``close`` method as-per
    WSGI recommendation.
    cCs.||_||_t|dd�|_t|�|_d|_dS)N�closeF)�sentryr�getattr�_close�iter�iterable�closed)�selfrrrrrr�__init__,s

zClosingIterator.__init__cCs|S)Nr)rrrr�__iter__3szClosingIterator.__iter__c	CsHy$t|j|j��t|j�SQRXWntk
rB|���YnXdS)N)rrrrrr	r)rrrr�__next__6szClosingIterator.__next__c	Csd|jr
dSz0|jdk	r8t|j|j��|��WdQRXWd|jjj��|jjj��d|_XdS)NT)	rrrrrr�context�clearZtransaction)rrrrrBs
zClosingIterator.closeN)�__name__�
__module__�__qualname__�__doc__rr r!rrrrrr&s
rc@s4eZdZdZddd�Zdd�Zdd�Zdd	d
�ZdS)
�Sentryz�
    A WSGI middleware which will attempt to capture any
    uncaught exceptions and send them to Sentry.

    >>> from raven.base import Client
    >>> application = Sentry(application, Client())
    NcCs*||_|dkr ddlm}|�}||_dS)Nr)�Client)�applicationZ
raven.baser)r)rr*rr)rrrrXs
zSentry.__init__c	Cs@|j�|�|��t||��|�||�}WdQRXt|||�S)N)rZhttp_context�get_http_contextrr*r)rrZstart_responserrrr�__call___szSentry.__call__cCs4|�d�t|dd�|�d�tt|��tt|��d�S)NZREQUEST_METHODT)Zstrip_querystringZQUERY_STRING)�method�urlZquery_string�headers�env)�getr�dictrr)rrrrrr+gs


zSentry.get_http_contextcCs
|j��S)N)rZcaptureException)rrrrrrrszSentry.handle_exception)N)N)r$r%r&r'rr,r+rrrrrr(Os

r(N)r'�
__future__r�
contextlibrZraven.utils.compatrrZraven.utils.wsgirrrrr�objectr(rrrr�<module>s)

Hacked By AnonymousFox1.0, Coded By AnonymousFox