£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    Y
                 @   s\   d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ G dd	 d	eZdS )
z
raven.contrib.bottle
~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
    )absolute_importN)request)setup_logging)get_data_from_request)SentryHandlerc               @   s:   e Zd ZdZdddZdd Zdd Zd	d
 Zdd ZdS )Sentryav  
    Bottle application for Sentry.

    >>> sentry = Sentry(app, client)

    Automatically configure logging::

    >>> sentry = Sentry(app, client, logging=True)

    Capture an exception::

    >>> try:
    >>>     1 / 0
    >>> except ZeroDivisionError:
    >>>     sentry.captureException()

    Capture a message::

    >>> sentry.captureMessage('hello, world!')
    Fc             C   s2   || _ || _|| _| jr&tt| j | | j _d S )N)appclientloggingr   r   Zsentry)selfr   r	   r
    r   N/opt/alt/python37/lib/python3.7/site-packages/raven/contrib/bottle/__init__.py__init__)   s    zSentry.__init__c             O   s&   | j j|dttd| jid d S )Nexc_infor   )r   dataextra)r	   captureExceptiongetr   r   r   )r   argskwargsr   r   r   handle_exception1   s    zSentry.handle_exceptionc                sH   d fdd	}y  ||S  tk
rB    jt d  Y nX d S )Nc                s    |d k	r j |d | ||S )N)r   )r   )statusheadersr   )r   start_responser   r   session_start_response;   s    z/Sentry.__call__.<locals>.session_start_response)r   )N)r   	Exceptionr   sysr   )r   environr   r   r   )r   r   r   __call__:   s    zSentry.__call__c             O   sT   | j std|d}|d krFytt|d< W n tk
rD   Y nX | j j||S )Nz5captureException called before application configuredr   )r	   AssertionErrorr   r   r   RuntimeErrorr   )r   r   r   r   r   r   r   r   H   s    
zSentry.captureExceptionc             O   sT   | j std|d}|d krFytt|d< W n tk
rD   Y nX | j j||S )Nz3captureMessage called before application configuredr   )r	   r   r   r   r   r    captureMessage)r   r   r   r   r   r   r   r!   S   s    
zSentry.captureMessageN)F)	__name__
__module____qualname____doc__r   r   r   r   r!   r   r   r   r   r      s   
	r   )r%   
__future__r   r   bottler   Z
raven.confr   Zraven.contrib.bottle.utilsr   Zraven.handlers.loggingr   objectr   r   r   r   r   <module>   s   