Your IP : 216.73.216.213
��Y� � @ s� d Z d d l m Z m Z d d l Z d d l m Z m Z m Z m Z m
Z
d d � Z d d d d
d � Z d d
� Z
d d � Z d d � Z d S)z�
raven.utils.encoding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
� )�absolute_import�unicode_literalsN)�
integer_types� text_type�binary_type�string_types�PY2c C sJ d d l } d d l } t | t t d � t | | j | j | j f � S)z�Determine if the object instance is of a protected type.
Objects of protected types are preserved as-is when passed to
force_text(strings_only=True).
r N)�Decimal�datetime�
isinstancer �type�float�date�time)�objr r
� r �E/opt/alt/python35/lib/python3.5/site-packages/raven/utils/encoding.py�is_protected_type s r zutf-8F�strictc s5 t | t � r | S� r) t | � r) | Sy� t | t � s� t | d � rY | j � } q� t s� t | t � r� t | � � � } q� t | � } q� t t | � � � � } n | j � � � } Wnn t k
r0} zN t | t
� s� t | j � � n( d j � � � f d d � | D� � } WYd d } ~ Xn X| S)z�
Similar to smart_text, except that lazy instances are resolved to
strings, rather than kept as lazy objects.
If strings_only is True, don't convert (some) non-string-like objects.
�__unicode__� c s% g | ] } t | � � � � � q Sr )�
force_text)�.0�arg)�encoding�errors�strings_onlyr r �
<listcomp>C s zforce_text.<locals>.<listcomp>N)
r r r r �hasattrr r �bytes�decode�UnicodeDecodeError� Exception�args�join)�sr r r �er )r r r r r s( r c C s* d d l m } t j d t � | | � S)Nr )� transformz5You should switch to raven.utils.serializer.transform)Zraven.utils.serializerr'