Your IP : 3.142.198.148


Current Path : /opt/alt/python27/lib/python2.7/site-packages/raven/utils/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyc

�
��Yc@@s�dZddlmZmZddlZddlmZmZmZm	Z	m
Z
d�Zdedd�Z
d	�Zd
�Zd�ZdS(u�
raven.utils.encoding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
i(tabsolute_importtunicode_literalsN(t
integer_typest	text_typetbinary_typetstring_typestPY2c	C@sJddl}ddl}t|ttd�t||j|j|jf�S(u�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).
    iN(	tDecimaltdatetimet
isinstanceRttypetNonetfloattdatettime(tobjRR((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pytis_protected_typesuutf-8ustrictcC@s,t|t�r|S|r)t|�r)|Sy�t|t�s�t|d�rY|j�}q�ts�t|t�r�t|||�}q�t|�}q�tt|�||�}n|j||�}Wnet	k
r'}t|t
�s�t	|j��q(djg|D]}t
||||�^q�}nX|S(u�
    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.
    u__unicode__u (R	RRRthasattrt__unicode__RtbytestdecodetUnicodeDecodeErrort	Exceptiontargstjoint
force_text(tstencodingtstrings_onlyterrorstetarg((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyRs(		,cC@s*ddlm}tjdt�||�S(Ni(t	transformu5You should switch to raven.utils.serializer.transform(traven.utils.serializerR twarningstwarntDeprecationWarning(tvalueR ((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyR Hs	cC@s�ytt|��}Wnittfk
r5d}nMtk
r�y"tttt|����}Wq�tk
r}d}q�XnX|S(Nu(Error decoding value)(RRtUnicodeEncodeErrorRRtreprR
(R%((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyt
to_unicodePs	
"
cC@sHy t|jd�jd��SWn!tk
rCt|�jd�SXdS(Nuutf-8(RRtencodeRR((R%((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyt	to_string]s 
(t__doc__t
__future__RRR"traven.utils.compatRRRRRRtFalseRR R(R*(((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/encoding.pyt<module>s(	,		

?>