Your IP : 3.22.217.176
�
��Yc @@ sT d Z d d l m Z d d l Z d d l m Z d � Z d d � Z d � Z d S( s�
raven.contrib.django.utils
~~~~~~~~~~~~~~~~~~~~~~~~~~
: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 settingsc c@ sY d V| j d � } x/ | d k rE | d V| j d | d � } q Wt | � d Vd S( Ni s
i ( t findt len( t template_sourcet p( ( sK /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/django/utils.pyt linebreak_iter s c C@ s d � } | d k r� | d } | d } g } | d g | d d d 7} x% | d D] \ } } | j | � qW W| d g d 7} n� | rL| \ } \ } }
t | d d � } } | j � } d } d }
g } x[ t t | � � D]G \ } } | |
k r|
| k r| } n | j | |
| !� | }
q� W| sE| d k rXi Sn t d � � | d k rsd
} d
} n | j d � d } | | t | d
d � | !� } | | | d | d !� } | | | g � d } i i t j
j | � d 6| d 6| d 6| d 6| d 6| d 6d 6| d 6S( Nc S@ s\ g } xO | D]G } t | t t f � rG t | � d k rG | d } n | j | � q
W| S( Ni i ( t
isinstancet listt tupleR t append( t itemst rvt item( ( sK /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/django/utils.pyt _remove_numbers s
'
t linet namet t source_linesi i t loadnames Source or debug neededs <unknown filename>s /templates/i����i i t filenamet abs_patht pre_contextt context_linet linenot post_contextt templatet culprit( t NoneR
t getattrt reloadt enumerateR t TypeErrort splitt maxt ost patht basename( t sourcet debugR R R R t numR t origint startt endR R t uptot nextR R R ( ( sK /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/django/utils.pyt get_data_from_template sP
c C@ s� t j r( d | j k r( | j d } np d | j k rG | j d } nQ | j d } t | j d � } | | j � r| d p d k r� d | | f } n | S( s]
A reimplementation of Django's get_host, without the
SuspiciousOperation check.
t HTTP_X_FORWARDED_HOSTt HTTP_HOSTt SERVER_NAMEt SERVER_PORTt 443t 80s %s:%s( R t USE_X_FORWARDED_HOSTt METAt strt is_secure( t requestt hostt server_port( ( sK /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/django/utils.pyt get_hostT s
(
t __doc__t
__future__R R# t django.confR R R R. R<