����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
raven
/
contrib
/
Filename :
flask.pyc
back
Copy
� ��Yc�����������@@��sk��d��Z��d�d�l�m�Z�y�d�d�l�m�Z�Wn�e�k �rC�e�Z�n�Xe�Z�d�d�l �Z �d�d�l �Z �d�d�l�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�m�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"�m#�Z#�d�d�l$�m%�Z%�e �j&����Z'�e'�j(�d���Z)�d�d���Z+�d�e,�f�d�������YZ�d�S(���s���� raven.contrib.flask ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. i����(���t���absolute_import(���t���current_userN(���t���requestt���current_appt���g(���t���got_request_exceptiont���request_finished(���t���ClientDisconnected(���t ���setup_logging(���t���Client(���t���Sentry(���t ���SentryHandler(���t���urlparse(���t ���to_unicode(���t���get_headerst���get_environ(���t���convert_optionst���logging_configuredc������ ���C@��sp���|��t��|�j�d�i�|�d�6t�|�j�j�d�g������t�|�j�g���Bd�6|�j�j�d�g����d�6i�|�d�6d�6����S( ���Nt���defaultst���dsnt���SENTRY_INCLUDE_PATHSt ���include_pathst���RAVEN_IGNORE_EXCEPTIONSt���ignore_exceptionst���appt���extra(���R���t���configt���sett���gett���import_name(���t ���client_clsR���R���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt���make_client'���s���� R ���c�������� ���B@��s����e��Z�d��Z�d�d�e�d�e�d�e�j�d�e�d�� �Z �e �d������Z�e�j�d������Z�d����Z �d����Z�d����Z�d����Z�d����Z�d ����Z�d�d ���Z�d����Z�d����Z�d�d�d�d�d�d�d ���Z�d����Z�d����Z�d����Z�d����Z�d����Z�RS(���s��� Flask application for Sentry. Look up configuration from ``os.environ['SENTRY_DSN']``:: >>> sentry = Sentry(app) Pass an arbitrary DSN:: >>> sentry = Sentry(app, dsn='http://public:secret@example.com/1') Pass an explicit client:: >>> sentry = Sentry(app, client=client) Automatically configure logging:: >>> sentry = Sentry(app, logging=True, level=logging.ERROR) Capture an exception:: >>> try: >>> 1 / 0 >>> except ZeroDivisionError: >>> sentry.captureException() Capture a message:: >>> sentry.captureMessage('hello, world!') By default, the Flask integration will do the following: - Hook into the `got_request_exception` signal. This can be disabled by passing `register_signal=False`. - Wrap the WSGI application. This can be disabled by passing `wrap_wsgi=False`. - Capture information from Flask-Login (if available). c ��� ������C@��s����|�r%�t��|�t���r%�t�d�����n��|�|��_�|�|��_�|�|��_�|�|��_�|�|��_�|�|��_�|�|��_ �| �|��_ �|�r��|��j�|���n��d��S(���Ns&���client should be an instance of Client(���t ���isinstanceR ���t ���TypeErrorR���t���loggingt���logging_exclusionsR���t���clientt���levelt ���wrap_wsgit���register_signalt���init_app( ���t���selfR���R$���R���R���R"���R#���R%���R&���R'���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt���__init__e���s���� c���������C@��s/���y�t��j�SWn�t�k �r�n�Xt�|��d�d����S(���Nt���_last_event_id(���R���t���sentry_event_idt ���Exceptiont���getattrt���None(���R)���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt ���last_event_idw���s ���� c���������C@��s.���|�|��_��y �|�t�_�Wn�t�k �r)�n�Xd��S(���N(���R+���R���R,���R-���(���R)���t���value(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR0������s ���� c���������O@��s*���|��j��s �d��S|��j�d�|�j�d�����d��S(���Nt���exc_info(���R$���t���captureExceptionR���(���R)���t���argst���kwargs(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt���handle_exception����s���� c���������C@��s��i��}�y�|�j��d�}�Wn�t�k �r3�|�j�}�n�X|�rG�|�|�d�<n��t�sQ�|�St�t�d���sd�|�Sy �t�j�}�Wn�t�k �r��|�SXt �|���r��|����}�n��|�s��|�St�j ����|�d�<d�t�j�k�rx=�t�j�d�D]+�}�t�t�|���r��t�t�|���|�|�<q��q��Wn��|�S(���su��� Requires Flask-Login (https://pypi.python.org/pypi/Flask-Login/) to be installed and setup. i����t ���ip_addresst ���login_managert���idt���SENTRY_USER_ATTRS( ���t���access_routet ���IndexErrort���remote_addrt���has_flask_logint���hasattrR���R���t���is_authenticatedt���AttributeErrort���callablet���get_idR���R.���(���R)���R���t ���user_infoR7���R@���t���attr(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt ���get_user_info����s2���� c���������C@��s7���|��j��|�j���r�|��j�}�n �|��j�}�|��j�|�|���S(���sR��� Determine how to retrieve actual data by using request.mimetype. (���t���is_json_typet���mimetypet ���get_json_datat ���get_form_datat���get_http_info_with_retriever(���R)���R���t ���retriever(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt ���get_http_info����s���� c���������C@��s ���|�d�k�S(���Ns���application/json(����(���R)���t���content_type(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyRG�������s����c���������C@��s���|�j��S(���N(���t���form(���R)���R���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyRJ�������s����c���������C@��s���|�j��S(���N(���t���data(���R)���R���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyRI�������s����c���������C@��s����|�d�k�r�|��j�}�n��t�j�|�j���}�y�|�|���}�Wn�t�k �rS�i��}�n�Xi�d�|�j�|�j�|�j�f�d�6|�j �d�6|�j �d�6|�d�6t�t�|�j �����d�6t�t�|�j �����d�6S( ���sT��� Exact method for getting http_info but with form data work around. s ���%s://%s%st���urlt���query_stringt���methodRP���t���headerst���envN(���R/���RJ���R���t���urlsplitRQ���R���t���schemet���netloct���patht���queryRS���t���dictR���t���environR���(���R)���R���RL���t���urlpartsRP���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyRK�������s���� c���������O@��s����d��|��_�t�j�r.�|��j�j�j�t�j�j���n��y�|��j�j�|��j �t�����Wn,�t �k �ry�}�|��j�j�j�t �|�����n�Xy�|��j�j�|��j�t�����Wn,�t �k �r��}�|��j�j�j�t �|�����n�Xd��S(���N(���R/���R0���R���t���url_ruleR$���t���transactiont���pusht���rulet���http_contextRM���R-���t���loggert ���exceptionR ���t���user_contextRF���(���R)���R4���R5���t���e(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt���before_request����s���� c���������O@��sU���|��j��r�|��j��|�j�d�<n��|��j�j�j����t�j�rQ�|��j�j�j�t�j�j ���n��|�S(���Ns���X-Sentry-ID( ���R0���RT���R$���t���contextt���clearR���R^���R_���t���popRa���(���R)���t���sendert���responseR4���R5���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt ���after_request����s���� c��� ������C@��s��|�d��k �r�|�|��_�n��|�d��k �r0�|�|��_�n��|�d��k �rH�|�|��_�n6�|��j�d��k�r~�|�rr�|�j�rr�t�|��_�q~�t�|��_�n��|�d��k �r��|�|��_�n��|�d��k �r��|�|��_�n��|�d��k �r��|�|��_ �n��|��j �s��t�|��j�|�|��j���|��_ �n��|��j�r~i��}�|��j �d��k �r|��j �|�d�<n��t �|��j �d�|��j��} �t�| �|���|�j�j�t�k�re|�j�j�| ���n��t�j�|��d�t �|��n��|��j�r�t�|�j�|��j ���|�_�n��|�j�|��j���t�j�|��j�d�|��|��j�r�t�j�|��j�d�|��n��t�|�d���si��|�_�n��|��|�j�d�<d��S(���Nt���excludeR%���t���sentry_handlerRk���t ���extensionst���sentry(���R/���R���R%���R&���t���debugt���Falset���TrueR'���R"���R#���R$���R���R���R���R���Rc���t ���propagatet ���addHandlerR���t���sendt���SentryMiddlewaret���wsgi_appRg���R���t���connectRm���R���R6���R?���Rp���( ���R)���R���R���R"���R%���R#���R&���R'���R5���t���handler(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR(�������sJ���� c���������O@��sU���|��j��s�t�d�����|��j��j�|�|����}�|�rH�|��j��j�|���|��_�n �d��|��_�|�S(���Ns5���captureException called before application configured(���R$���t���AssertionErrorR3���t ���get_identR0���R/���(���R)���R4���R5���t���result(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR3���3��s���� c���������O@��sU���|��j��s�t�d�����|��j��j�|�|����}�|�rH�|��j��j�|���|��_�n �d��|��_�|�S(���Ns3���captureMessage called before application configured(���R$���R|���t���captureMessageR}���R0���R/���(���R)���R4���R5���R~���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR���<��s���� c���������O@��s(���|��j��s�t�d�����|��j��j�|�|����S(���Ns1���user_context called before application configured(���R$���R|���Re���(���R)���R4���R5���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyRe���E��s����c���������O@��s(���|��j��s�t�d�����|��j��j�|�|����S(���Ns1���tags_context called before application configured(���R$���R|���t���tags_context(���R)���R4���R5���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR����I��s����c���������O@��s(���|��j��s�t�d�����|��j��j�|�|����S(���Ns2���extra_context called before application configured(���R$���R|���t ���extra_context(���R)���R4���R5���(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR����M��s����N(���t���__name__t ���__module__t���__doc__R/���R ���Rs���R"���t���NOTSETRt���R*���t���propertyR0���t���setterR6���RF���RM���RG���RJ���RI���RK���Rg���Rm���R(���R3���R���Re���R����R����(����(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyR ���;���s.���& , 7 (-���R����t ���__future__R����t���flask_loginR���t���ImportErrorRs���R>���Rt���R"���t���blinkert���flaskR���R���R���t ���flask.signalsR���R���t���werkzeug.exceptionsR���t ���raven.confR���t ���raven.baseR ���t���raven.middlewareR ���Rx���t���raven.handlers.loggingR���t���raven.utils.compatR���t���raven.utils.encodingR ���t���raven.utils.wsgiR���R���t���raven.utils.confR���t ���Namespacet ���raven_signalst���signalR���R/���R���t���object(����(����(����sD���/opt/alt/python27/lib/python2.7/site-packages/raven/contrib/flask.pyt���<module>���s.���