관리-도구
편집 파일: templates.cpython-37.opt-1.pyc
B T a � @ s� d dl mZ d dlmZ d dlmZmZ d dlm Z e rtd dl mZ d dl mZ d dl m Z d dl mZ d d l mZ yd d lmZ W n ek r� d dlmZ Y nX dd � Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )� )�TemplateSyntaxError)�VERSION)� _functools�Hub)�MYPY)�Any)�Dict)�Optional)�Iterator)�Tuple)�Origin)�LoaderOriginc C sj t | d�rt| j�S t | d�r(t| j�S t| t�rft | d�rf| j}t|tt f�rft|d t �rft|�S d S )N�template_debug�django_template_source�sourcer )�hasattr�_get_template_frame_from_debugr �_get_template_frame_from_sourcer � isinstancer r �tuple�listr )� exc_valuer � r �Y/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/django/templates.py�!get_template_frame_from_exception s r c C s* t | ttf�r"| r&d�| d �S n| S d S )Nz [{}, ...]r )r r r �format)� template_namer r r �_get_template_name_description- s r c sx ddl m} ddlm� | j�t� �fdd��}|| _tdk rBd S dd l}|jj �t ���d � �fdd� �}||j_ d S ) Nr )�SimpleTemplateResponse)�DjangoIntegrationc sV t j}|�� �d kr��| �S |jdt| j�d��}|�d| j� ��| �S Q R X d S )Nzdjango.template.render)�op�description�context) r �current�get_integration�fget� start_spanr r �set_dataZcontext_data)�self�hub�span)r �real_rendered_contentr r �rendered_content= s z)patch_templates.<locals>.rendered_content)� � c sf t j}|�� �d kr(�| ||f|�|�S |jdt|�d��"}|�d|� �| ||f|�|�S Q R X d S )Nzdjango.template.render)r r! r"