관리-도구
편집 파일: middleware.cpython-37.pyc
B ��Y � @ sp d Z ddlmZ ddlmZ ddlmZmZ ddlm Z m Z mZ edd� �ZG dd � d e�Z G d d� de�ZdS ) 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 c s� y d V W n� t tfk r$ � Y nt tk rB |�| � � Y nV tk r` |�| � � Y n8 tk r� } z|jdkr�|�| � � W d d }~X Y nX d S )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_handling s r c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd S )�ClosingIteratorz[ An iterator that is implements a ``close`` method as-per WSGI recommendation. c C s. || _ || _t|dd �| _t|�| _d| _d S )N�closeF)�sentryr �getattr�_close�iter�iterable�closed)�selfr r r r r r �__init__, s zClosingIterator.__init__c C s | S )Nr )r r r r �__iter__3 s zClosingIterator.__iter__c C sH y$t | j| j�� t| j�S Q R X W n tk rB | �� � Y nX d S )N)r r r r r r r )r r r r �__next__6 s zClosingIterator.__next__c C sd | j r d S z0| jd k r8t| j| j�� | �� W d Q R X W d | jjj�� | jjj�� d| _ X d S )NT) r r r r r r �context�clearZtransaction)r r r r r B s zClosingIterator.closeN)�__name__� __module__�__qualname__�__doc__r r r! r r r r r r &