ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     
Yc           @@  s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l 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 d d l m Z e j d	 d
 f k r d d l Z n d d l Z y d d l m Z Wn! e k
 r!d d l m Z n Xd d l Z d d l m Z d d l m Z d d l  m! Z! m" Z" d d l# m$ Z$ m% Z% m& Z& m' Z' d d l( m) Z) m* Z* d d l+ m, Z, d d l- m. Z. d d l/ m0 Z0 m1 Z1 d d l2 m3 Z3 d d l4 m5 Z5 m6 Z6 d d l7 Z d f Z8 e9 a: d Z; i d d 6e j< d 6Z= e9 a> e j d	 d
 f k rTe? Z@ n  d   ZA d eB f d     YZC d eD f d     YZE d eD f d      YZF d! eF f d"     YZG d S(#   s   
raven.base
~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
i    (   t   absolute_importN(   t   datetime(   t   isclass(   t   Random(   t   FunctionType(   t   locali   i   (   t	   get_ident(   t   defaults(   t   RemoteConfig(   t   APIErrort   RateLimited(   t   jsont   get_versionst   get_auth_headert   merge_dicts(   t	   text_typet	   iteritems(   t
   to_unicode(   t	   transform(   t   get_stack_infot   iter_stack_frames(   t   TransactionStack(   t   TransportRegistryt   default_transportst   Clientt   pythons   raven-pythont   namet   versionc          C@  s/   t  j }  t |  d d   } | d  k	 r+ | Sd  S(   Nt   raven_client(   t   syst
   excepthookt   getattrt   None(   t   hookt   client(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   get_excepthook_clientE   s    	t   ModuleProxyCachec           B@  s   e  Z d    Z RS(   c         C@  sG   | j  d d  \ } } t t | i  i  | g  |  } | |  | <| S(   Nt   .i   (   t   rsplitR   t
   __import__(   t   selft   keyt   modulet
   class_namet   handler(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   __missing__M   s
    
(   t   __name__t
   __module__R-   (    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR$   L   s   t   ClientStatec           B@  sD   e  Z d  Z d Z d   Z d   Z d d  Z d   Z d   Z RS(   i   i    c         C@  s+   |  j  |  _ d  |  _ d |  _ d |  _ d  S(   Ni    (   t   ONLINEt   statusR    t
   last_checkt   retry_numbert   retry_after(   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   __init__\   s    		c         C@  sV   |  j  |  j k r t S|  j p2 t |  j d  d } t j   |  j | k rR t St S(   Ni   i   (	   R2   R1   t   TrueR5   t   minR4   t   timeR3   t   False(   R(   t   interval(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt
   should_tryb   s    c         C@  s7   |  j  |  _ |  j d 7_ t j   |  _ | |  _ d  S(   Ni   (   t   ERRORR2   R4   R9   R3   R5   (   R(   R5   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   set_failm   s    c         C@  s+   |  j  |  _ d  |  _ d |  _ d |  _ d  S(   Ni    (   R1   R2   R    R3   R4   R5   (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   set_successs   s    		c         C@  s   |  j  |  j k S(   N(   R2   R=   (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   did_faily   s    (	   R.   R/   R1   R=   R6   R<   R>   R?   R@   (    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR0   X   s   			c        	   B@  s9  e  Z d  Z e j d  Z d Z e d e  Z	 d/ e d/ e e d/ e d/ d  Z d   Z d/ d/ d  Z d   Z d   Z d	   Z e d
    Z d   Z d   Z d   Z d   Z d/ d  Z d   Z d   Z d   Z d/ d/ d/ d/ d/ d/ d/ d/ d  Z d   Z e d    Z  d   Z! d   Z" d   Z# d   Z$ d/ d/ d/ d/ d/ d/ d/ d  Z% d   Z& d   Z' d   Z( d   Z) d   Z* d/ d   Z+ d/ d!  Z, d/ d"  Z- d#   Z. d$   Z/ d%   Z0 d&   Z1 d/ d'  Z2 d(   Z3 d/ d)  Z4 d0 d/ d*  Z5 d+   Z6 d,   Z7 e7 Z8 e d-    Z9 e9 j: d.    Z9 RS(1   sU  
    The base Raven client.

    Will read default configuration from the environment variable
    ``SENTRY_DSN`` if available.

    >>> from raven import Client

    >>> # Read configuration from ``os.environ['SENTRY_DSN']``
    >>> client = Client()

    >>> # Specify a DSN explicitly
    >>> client = Client(dsn='https://public_key:secret_key@sentry.local/project_id')

    >>> # Record an exception
    >>> try:
    >>>     1/0
    >>> except ZeroDivisionError:
    >>>     ident = client.get_ident(client.captureException())
    >>>     print "Exception caught; reference is %s" % ident
    t   ravent   6t
   transportsc	         K@  s  |	 }
 t    |  _ | |  _ |  j } t   |  _ t j d | j | j	 f  |  _
 t j d  |  _ t j d  |  _ i  |  _ |  j | |  t |
 j d  p g   |  _ t |
 j d  p g   |  _ t |
 j d  p |
 j d  p t j  |  _ t |
 j d  pt j  |  _ t |
 j d	 t j   |  _ t |
 j d
  pRt j  |  _ t |
 j d  pst j  |  _  |
 j d  |  _! |
 j d t"  |  _# |
 j d  |  _$ |  j$ d  k rt j& |  _$ n  |
 j d  } | d  k ri t' t( d g   d 6} n  | |  _) |
 j d  p&i  |  _* |
 j d  p>d  |  _+ |
 j d  pbt, j- j d  |  _. |  j/ |
 j d   |  _0 |
 j d  d  k	 r|
 j d  n d |  _1 t2   |  _3 t |
 j d  pd  |  _4 t5   |  _6 t7 |  |  _8 |  j9   s|  j
 j: d  n  t; d  k r)|  a; n  t<   |  _= | |  _> d d l? m@ } | |   |  _A | rp|  jB   n  | r|  jC   n  |  jD |  d  S(   Ns   %s.%ss   sentry.errorss   sentry.errors.uncaughtt   include_pathst   exclude_pathsR   t   machinet   auto_log_stackst   capture_localst   string_max_lengtht   list_max_lengtht   sitet   include_versionst
   processorst   contextt   argvs   sys.argvt   tagst   environmentt   releaset   HEROKU_SLUG_COMMITt   repost   sample_ratei   t   ignore_exceptionssa   Raven is not configured (logging is disabled). Please see the documentation for more information.i    (   t   Context(    (E   R   t   _local_statet   raise_send_errorst	   __class__R0   t   statet   loggingt	   getLoggerR/   R.   t   loggert   error_loggert   uncaught_loggert   _transport_cachet   set_dsnt   sett   getRD   RE   R   R   t   NAMER   t   boolt   AUTO_LOG_STACKSRG   t   CAPTURE_LOCALSRH   t   intt   MAX_LENGTH_STRINGRI   t   MAX_LENGTH_LISTRJ   RK   R7   RL   RM   R    t
   PROCESSORSR   R   t   extraRP   RQ   t   ost   environRR   t   _format_reposRT   RU   R   t   transactionRV   R$   t   module_cacheR   t   _randomt
   is_enabledt   infot   Ravent   get_thread_identt   main_thread_idt   enable_breadcrumbst   raven.contextRW   t   _contextt   install_sys_hookt   install_logging_hookt   hook_libraries(   R(   t   dsnRY   t	   transportR|   R}   R~   Ry   t   _random_seedt   optionst   ot   clsRN   RW   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR6      sn    			0	$$		
		c         C@  si   | s
 i  Si  } xR t  |  D]D \ } } | d d k rW t j j t |  j  } n  | | | <q W| S(   Ni    t   /(   R   Rn   t   patht   abspathR'   t   __file__(   R(   t   valuet   resultR   t   config(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyRp      s    c         C@  s   | r? t  j j d  r? d } |  j j |  t  j d } n  | |  j k r | sf t d |  } n t j | d | d |  j } | |  j | <| |  _	 n |  j | |  _	 |  j j d j
 |  j	   d  S(   Nt
   SENTRY_DSNs8   Configuring Raven from environment variable 'SENTRY_DSN'R   t   transport_registrys   Configuring Raven for host: {0}(   Rn   Ro   Rd   R^   t   debugRa   R   t   from_stringt	   _registryt   remotet   format(   R(   R   R   t   msgR   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyRb      s    c         @  s=   t  d  k r t j a  n    f d   }   | _ | t _ d  S(   Nc          @  s$     j  d |  d d  t |    d  S(   Nt   exc_infot   levelt   fatal(   t   captureExceptiont   __excepthook__(   R   (   R(   (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   handle_exception  s    (   R   R    R   R   R   (   R(   R   (    (   R(   s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR|     s
    	c         C@  s   d d l  m } |   d  S(   Ni    (   R}   (   t   raven.breadcrumbsR}   (   R(   R}   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR}     s    c         C@  s   d d l  m } | |  d  S(   Ni    (   R~   (   R   R~   (   R(   t	   librariesR~   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR~     s    c         C@  s   |  j  j | |  d  S(   N(   R   t   register_scheme(   R   t   schemet   transport_class(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   "  s    c         c@  s*   x# |  j  D] } |  j | |   Vq
 Wd  S(   N(   RM   Rr   (   R(   t	   processor(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   get_processors&  s    c         C@  sN   |  j  s i  St j } t |  j  } d j | d | d | d  | d <| S(   Ns   {0}.{1}.{2}i    i   i   R   (   RL   R   t   version_infoR   RD   R   (   R(   R   t   modules(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   get_module_versions*  s    		c         C@  s   t  j d t  | S(   s   
        Returns a searchable string representing a message.

        >>> result = client.capture(**kwargs)
        >>> ident = client.get_ident(result)
        sV   Client.get_ident is deprecated. The event ID is now returned as the result of capture.(   t   warningst   warnt   DeprecationWarning(   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   7  s    	c         C@  s   |  j  | |   S(   N(   Rr   (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   get_handlerC  s    c         C@  s7   |  j    s d S|  j j   } | s) | Sd | | f S(   s   
        Returns a public DSN which is consumable by raven-js

        >>> # Return scheme-less DSN
        >>> print client.get_public_dsn()

        >>> # Specify a scheme to use (http or https)
        >>> print client.get_public_dsn('https')
        Ns   %s:%s(   Rt   R   t   get_public_dsn(   R(   R   t   url(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   F  s    
c         C@  s   d } d } yA t  | d o) | d j j  } | d rF | d j pI d } Wn t t f k
 rf n X| d t  | d  | t  | d  | f S(   Ni    i   i   (   t   idt   tb_framet   f_codet   tb_lastit   AttributeErrort
   IndexError(   R(   R   t   code_idt   last_id(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   _get_exception_keyW  s     !c         C@  s   |  j  |  } | |  j j k S(   N(   R   RN   t   exceptions_to_skip(   R(   R   R)   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   skip_error_for_loggingi  s    c         C@  s&   |  j  |  } |  j j j |  d  S(   N(   R   RN   R   t   add(   R(   R   R)   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   record_exception_seenm  s    c
         @  s  t  j   j } t |  j j |  } | j d i   | j d i   d | k r] d | } n  |  j |  } | j |
   } | j	 d d   } | j d  r | d } n  x3 t |  D]% \ } } | | k r | | | <q q W| d  k rd | k r|  j } n  | rhd | k rh| t k r-t   } n | } t | d |  j d	 |  j } | j i | d 6 n  |  j r#x |  j |  D] } | j d
  d  k	 rqn  | j d      sqn    j d  rt | d
 <qt   f d   |  j D  ot   f d   |  j D  | d
 <qWn  | s;|  j j   } n  | j d  si|
 j d  p_t j | d <n  | j d  s|  j | d <n  | j d  s|  j   | d <n  |  j  d  k	 r|  j  | d <n  |  j! d  k	 r|  j! | d <n  t |  j" | d |  | d <t |  j# | d |  | d <| j	 d d   p:|  j$ } | rZ| d j d |  n  | rm| | d <n  |	 r|	 | d <n  x* |  j%   D] } | j | j& |   qWd | k r|
 j d | j' |   | d <n  x2 t | d  D]  \ } } t( |  | d | <qWx5 t | d  D]# \ } } |  j |  | d | <q!W| j d |  j) j*  | j d | pvt+ j,    | j d |  | j d |  | j d t-  | j d t.  | j d |  j/  |  j0 r|  j j1 j2   } | r| j d i | d 6 qn  | S(!   s   
        Captures, processes and serializes an event into a dict object

        The result of ``build_msg`` should be a standardized dict, with
        all default values available.
        RP   Rm   R%   s   raven.events.%st   culpritt	   exceptiont
   stacktracet   transformerRH   t   in_appR*   s   raven.c         3@  s   |  ] }   j  |  Vq d  S(   N(   t
   startswith(   t   .0t   x(   R   (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>  s    c         3@  s   |  ] }   j  |  Vq d  S(   N(   R   (   R   R   (   R   (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>  s    R   t   server_nameR   RR   RQ   RK   t   fingerprintt   messaget   projectt	   timestampt
   time_spentt   event_idt   platformt   sdkRT   t   breadcrumbst   valuesN(3   t   uuidt   uuid4t   hexR   RN   t   datat
   setdefaultR   t   capturet   popR    Rd   R   RG   R7   R   R   R   RH   t   updateRD   t   _iter_framesR   R:   t   anyRE   Rq   t   peekR\   R=   R   R   RR   RQ   RP   Rm   RK   R   t   processt	   to_stringR   R   R   R   t   utcnowt   PLATFORM_NAMEt	   SDK_VALUERT   Ry   R   t
   get_buffer(   R(   t
   event_typeR   t   dateR   Rm   t   stackt
   public_keyRP   R   t   kwargsR   R,   R   R   t   kt   vt   framest
   stack_infot   frameRK   R   R)   R   t   crumbs(    (   R   s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt	   build_msgq  s    
			+"	c         C@  s   t  | d |  j d |  j S(   NRJ   RI   (   R   RJ   RI   (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    c         C@  s   |  j  S(   sT  
        Updates this clients thread-local context for future events.

        >>> def view_handler(view_func, *args, **kwargs):
        >>>     client.context.merge(tags={'key': 'value'})
        >>>     try:
        >>>         return view_func(*args, **kwargs)
        >>>     finally:
        >>>         client.context.clear()
        (   R{   (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyRN     s    c         C@  s   |  j  j i | d 6 S(   s{   
        Update the user context for future events.

        >>> client.user_context({'email': 'foo@example.com'})
        t   user(   RN   t   merge(   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   user_context  s    c         K@  s   |  j  j i | d 6 S(   s|   
        Update the http context for future events.

        >>> client.http_context({'url': 'http://example.com'})
        t   request(   RN   R   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   http_context  s    c         K@  s   |  j  j i | d 6 S(   so   
        Update the extra context for future events.

        >>> client.extra_context({'foo': 'bar'})
        Rm   (   RN   R   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   extra_context$  s    c         K@  s   |  j  j i | d 6 S(   sr   
        Update the tags context for future events.

        >>> client.tags_context({'version': '1.0'})

        RP   (   RN   R   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   tags_context.  s    c	      
   K@  s   |  j    s d S|	 j d  }
 |
 d k	 r |  j |
  r> d S|  j |
  st |  j j d |
 d d t j   d S|  j	 |
  n  |  j
 | | | | | | d | |	 } | d k r |  j } n  |  j j   | k  r |  j |   n  | d |  j _ | d S(   s  
        Captures and processes an event and pipes it off to SentryClient.send.

        To use structured data (interfaces) with capture:

        >>> capture('raven.events.Message', message='foo', data={
        >>>     'request': {
        >>>         'url': '...',
        >>>         'data': {},
        >>>         'query_string': '...',
        >>>         'method': 'POST',
        >>>     },
        >>>     'logger': 'logger.name',
        >>> }, extra={
        >>>     'key': 'value',
        >>> })

        The finalized ``data`` structure contains the following (some optional)
        builtin values:

        >>> {
        >>>     # the culprit and version information
        >>>     'culprit': 'full.module.name', # or /arbitrary/path
        >>>
        >>>     # all detectable installed modules
        >>>     'modules': {
        >>>         'full.module.name': 'version string',
        >>>     },
        >>>
        >>>     # arbitrary data provided by user
        >>>     'extra': {
        >>>         'key': 'value',
        >>>     }
        >>> }

        :param event_type: the module path to the Event class. Builtins can use
                           shorthand class notation and exclude the full module
                           path.
        :param data: the data base, useful for specifying structured data
                           interfaces. Any key which contains a '.' will be
                           assumed to be a data interface.
        :param date: the datetime of this event
        :param time_spent: a integer value representing the duration of the
                           event (in milliseconds)
        :param extra: a dictionary of additional standard metadata
        :param stack: a stacktrace for the event
        :param tags: dict of extra tags
        :param sample_rate: a float in the range [0, 1] to sample this message
        :return: a tuple with a 32-length string identifying this event
        NR   s*   Not capturing exception due to filters: %si    RP   R   (   Rt   Rd   R    R   t   should_captureR^   Ru   R   R   R   R   RU   Rs   t   randomt   sendRX   t   last_event_id(   R(   R   R   R   R   Rm   R   RP   RU   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   9  s*    5		c         C@  s   |  j  j   S(   sg   
        Return a boolean describing whether the client should attempt to send
        events.
        (   R   t	   is_active(   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyRt     s    c         c@  sr   d | k r- x | d d D] } | Vq Wn  d | k rn x2 | d d d d j  d g   D] } | Vq\ Wn  d  S(   NR   R   R   R   i(   Rd   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    )c         C@  s   |  j  j   d  S(   N(   R[   R?   (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   _successful_send  s    c      
   C@  s   d } t  | t  rU t  | t  r0 | j } n  |  j j d t |  j | j  n) |  j j d | | d t	 d i | d 6|  j
 |  |  j j d |  d  S(   Ni    s*   Sentry responded with an API error: %s(%s)s,   Sentry responded with an error: %s (url: %s)R   Rm   R   R5   (   t
   isinstanceR	   R
   R5   R_   t   errort   typeR.   R   R7   t   _log_failed_submissionR[   R>   (   R(   t   excR   R   R5   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   _failed_send  s    			c         C@  s   | j  d d  } | g } d | k r d | d d d k r xw | d d d d j d g   D]P } | j d i | j d	 d
  d 6| j d d  d 6| j d d  d 6 qb Wn  |  j j |  d S(   sj   
        Log a reasonable representation of an event that should have been sent
        to Sentry
        R   s   <no message value>R   R   R   iR   s-     File "%(fn)s", line %(lineno)s, in %(func)st   filenamet   unknown_filenamet   fnt   linenot   functiont   unknown_functiont   funcN(   R   Rd   t   appendR`   R   (   R(   R   R   t   outputR   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    	$)c         @  s  | d  k r i  } n   j rO  j j   rO  j       j    d  S j j d t          f d   } yX  j	 j
   } | j r | j    |  j |  n | j    |   j   Wn, t k
 r}  j r   n  | |  n Xd  S(   Ns"   Sending message of length %d to %sc         @  s     j  |    j     d  S(   N(   R   t   decode(   t   e(   R   R(   R   (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   failed_send  s    (   R    RY   R[   R<   R  R   R^   R   t   lenR   t   get_transportt   is_asynct
   async_sendR   R   t	   Exception(   R(   R   R   t   headersR  R   R  (    (   R   R(   R   s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   send_remote  s&    		
	c         K@  s"   |  j  |  } |  j | d | S(   sV   
        Serializes the message and passes the payload onto ``send_encoded``.
        t   auth_header(   t   encodet   send_encoded(   R(   R  R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    c         K@  s   d t  j f } | s[ t j   } t d |  j d | d | d |  j j d |  j j  } n  i | d 6| d 6|  j   d	 6d
 d 6} |  j	 d |  j j
 d | d | |  S(   s   
        Given an already serialized message, signs the message and passes the
        payload off to ``send_remote``.
        s   raven-python/%st   protocolR   R"   t   api_keyt
   api_secrets
   User-Agents   X-Sentry-Auths   Content-Encodings   application/octet-streams   Content-TypeR   R   R  (   RA   t   VERSIONR9   R   t   protocol_versionR   R   t
   secret_keyt   get_content_encodingR  t   store_endpoint(   R(   R   R  R   t   client_stringR   R  (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR    s&    	
	c         C@  s   d S(   Nt   deflate(    (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR    s    c         C@  s   t  j t j |  j d   S(   s8   
        Serializes ``data`` into a raw string.
        t   utf8(   t   zlibt   compressR   t   dumpsR  (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR  
  s    c         C@  s   t  j t j |  j d   S(   s2   
        Unserializes a string, ``data``.
        R  (   R   t   loadsR  t
   decompressR  (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR    s    c         K@  s   |  j  d d | | S(   sr   
        Creates an event from ``message``.

        >>> client.captureMessage('My event just happened!')
        s   raven.events.MessageR   (   R   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   captureMessage  s    c         K@  s=   | d k s | t k r' t j   } n  |  j d d | | S(   s  
        Creates an event from an exception.

        >>> try:
        >>>     exc_info = sys.exc_info()
        >>>     client.captureException(exc_info)
        >>> finally:
        >>>     del exc_info

        If exc_info is not provided, or is set to True, then this method will
        perform the ``exc_info = sys.exc_info()`` and the requisite clean-up
        for you.

        ``kwargs`` are passed through to ``.capture``.
        s   raven.events.ExceptionR   N(   R    R7   R   R   R   (   R(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    c         @  s   | d  d  j   j f   |  j } d   | D } d   | D } d   | D }  | k ri t S j | k r| t S  | k r t St  f d   | D  r t St   f d   | D  r t St S(   Ni    s   %s.%sc         s@  s$   |  ] } t  | t  r | Vq d  S(   N(   R   t
   basestring(   R   R  (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>8  s    c         s@  s$   |  ] } | j  d   r | Vq d S(   t   *N(   t   endswith(   R   R  (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>9  s    c         s@  s!   |  ] } t  |  r | Vq d  S(   N(   R   (   R   R  (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>:  s    c         3@  s   |  ] } t    |  Vq d  S(   N(   t
   issubclass(   R   R  (   t   exc_type(    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>B  s    c         3@  s"   |  ] }   j  | d    Vq d S(   iN(   R   (   R   R  (   t   exc_name(    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pys	   <genexpr>D  s    (   R/   R.   RV   R:   R   R7   (   R(   R   t
   exclusionst   string_exclusionst   wildcard_exclusionst   class_exclusions(    (   R&  R%  s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   4  s"    
	c         @  sw   d } t f } t | t  r' | } n | d k	 r< | } n  t j    f d    } | |  } | rs | |  S| S(   s  
        Wrap a function or code block in try/except and automatically call
        ``.captureException`` if it raises an exception, then the exception
        is reraised.

        By default, it will capture ``Exception``

        >>> @client.capture_exceptions
        >>> def foo():
        >>>     raise Exception()

        >>> with client.capture_exceptions():
        >>>    raise Exception()

        You can also specify exceptions to be caught specifically

        >>> @client.capture_exceptions((IOError, LookupError))
        >>> def bar():
        >>>     ...

        >>> with client.capture_exceptions((IOError, LookupError)):
        >>>    ...

        ``kwargs`` are passed through to ``.captureException``.
        c         3@  s1   y	 d  VWn! |  k
 r,  j        n Xd  S(   N(   R   (   t
   exceptions(   R   R(   (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   make_decoratorj  s
    	N(   R    R
  R   R   t
   contextlibt   contextmanager(   R(   t   function_or_exceptionsR   R   R+  R,  t	   decorator(    (   R   R(   s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   capture_exceptionsH  s    			
c      	   K@  s"   |  j  d d | d | d | | S(   si   
        Creates an event for a SQL query.

        >>> client.captureQuery('SELECT * FROM foo')
        s   raven.events.Queryt   queryt   paramst   engine(   R   (   R(   R2  R3  R4  R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   captureQueryx  s    c         K@  s   t  j d t  |  j |   S(   Ns8   captureExceptions is deprecated, used context() instead.(   R   R   R   RN   (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   captureExceptions  s    c         O@  s   |  j  j j | |   d S(   sp   
        Records a breadcrumb with the current context.  They will be
        sent with the next event.
        N(   RN   R   t   record(   R(   t   argsR   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   captureBreadcrumb  s    c         C@  s   t  |  j d d   S(   NR   (   R   RX   R    (   R(   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    c         C@  s   | |  j  _ d  S(   N(   RX   R   (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    N(    (;   R.   R/   t   __doc__R\   R]   R^   R  R   R   R   R    R:   R7   R6   Rp   Rb   R|   R}   R~   t   classmethodR   R   R   R   R   R   R   R   R   R   R   t   propertyRN   R   R   R   R   R   Rt   R   R   R   R   R  R   R  R  R  R  R   R   R   R1  R5  R6  R9  t   capture_breadcrumbR   t   setter(    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR   }   sl   	Q													
	
	
		Q										0
		
t   DummyClientc           B@  s   e  Z d  Z d   Z RS(   s"   Sends messages into an empty void.c         K@  s   d  S(   N(   R    (   R(   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR     s    (   R.   R/   R:  R   (    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyR?    s   (H   R:  t
   __future__R    R  R\   Rn   R   R9   R   R   R   t   inspectR   R   R   t   typesR   t	   threadingR   R   R-  t   contextlib2t   threadR   Rw   t   ImportErrort   _threadRA   t
   raven.confR   t   raven.conf.remoteR   t   raven.exceptionsR	   R
   t   raven.utilsR   R   R   R   t   raven.utils.compatR   R   t   raven.utils.encodingR   t   raven.utils.serializerR   t   raven.utils.stacksR   R   t   raven.utils.transactionR   t   raven.transport.registryR   R   t   raven.eventst   __all__R    R   R   R  R   Rv   t   strR!  R#   t   dictR$   t   objectR0   R   R?  (    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/raven/base.pyt   <module>   sb   "			%   #