관리-도구
편집 파일: __init__.cpython-37.pyc
B ��Y% � @ s� d Z ddlmZ ddlmZmZmZ ddlmZ ddl m Z ddlZddlm Z ddlmZ e�e�ZG d d � d e �ZG dd� de�ZdS ) z� raven.contrib.zope ~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. � )�absolute_import)�getouterframes�currentframe�getinnerframes)� SentryHandler)�FactoryN)�nobody)�iter_stack_framesc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�ZopeSentryHandlerFactoryc C s | j jS )N)�section�level)�self� r �L/opt/alt/python37/lib/python3.7/site-packages/raven/contrib/zope/__init__.py�getLevel s z!ZopeSentryHandlerFactory.getLevelc C s t f | jj�S )N)�ZopeSentryHandlerr �__dict__)r r r r �create s zZopeSentryHandlerFactory.createc C s t �| � || _d S )N)r �__init__r )r r r r r r s z!ZopeSentryHandlerFactory.__init__N)�__name__� __module__�__qualname__r r r r r r r r s r c s4 e Zd ZdZ� fdd�Zdd� Z� fdd�Z� ZS )r z� Zope unfortunately eats the stack trace information. To get the stack trace information and other useful information from the request object, this class looks into the different stack frames when the emit method is invoked. c s. t t| �j||� |�dtj�}| �|� d S )Nr )�superr r �get�logging�ERROR�setLevel)r �args�kwr )� __class__r r r * s zZopeSentryHandler.__init__c C s |j dkp|j �d� S )N�raven)z sentry.errorszraven.)�name� startswith)r �recordr r r � can_record/ s zZopeSentryHandler.can_recordc s |j tjk�r�| �|��r�d }d }x�tt� �D ]�}|d }|s�|j�dd �}|s�|j�dd �}yt|dd �}W n t k r� d }Y nX |s�|j�dd �}t |d�s�d }|r.|r.P q.W |r�||_tt |d ��|_|�r�y�|j�� }|j�d� |j�� }|j�|� t|j|�� |j|j�dd�|d �} d | d k�rZd| d k�rZ| d d | d d<