%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/tornado/web.pyc

�
��L]c@�s3dZddlmZmZmZmZddlZddlZddlZddl	Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZddlm Z ddlm!Z!ddlm"Z"dd	lm#Z#dd
lm$Z$ddl%m&Z&m'Z'm(Z(ddlm)Z)dd
lm*Z*ddl+m,Z,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3ddl4m5Z5yddl6Z6Wn e7k
r>ddl8j9Z6nXyddl:Z:Wn e7k
rqddl;j<Z:nXyddl=m>Z>Wn!e7k
r�ddl;m>Z>nXdZ?dZ@dZAdZBdeCfd��YZDd�ZEd�ZFd�ZGd�ZHd�ZIde"jJfd��YZKde"jLfd��YZMdeNfd ��YZOd!eNfd"��YZPd#eOfd$��YZQd%eDfd&��YZRd'eDfd(��YZSd)eDfd*��YZTd+eDfd,��YZUd-eCfd.��YZVd/eVfd0��YZWd1�ZXd2eCfd3��YZYd4eYfd5��YZZd6eYfd7��YZ[d8eYfd9��YZ\d:eCfd;��YZ]d<eCfd=��YZ^e^Z_e`ed>�r�ejaZbn	d?�Zbecececd@�ZdejedA�ZfdB�ZgdCececdD�ZhdE�ZidF�ZjdG�ZkdH�ZldI�ZmdJ�ZndK�ZodS(Ls�``tornado.web`` provides a simple web framework with asynchronous
features that allow it to scale to large numbers of open connections,
making it ideal for `long polling
<http://en.wikipedia.org/wiki/Push_technology#Long_polling>`_.

Here is a simple "Hello, world" example app:

.. testcode::

    import tornado.ioloop
    import tornado.web

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")

    if __name__ == "__main__":
        application = tornado.web.Application([
            (r"/", MainHandler),
        ])
        application.listen(8888)
        tornado.ioloop.IOLoop.current().start()

.. testoutput::
   :hide:


See the :doc:`guide` for additional information.

Thread-safety notes
-------------------

In general, methods on `RequestHandler` and elsewhere in Tornado are
not thread-safe.  In particular, methods such as
`~RequestHandler.write()`, `~RequestHandler.finish()`, and
`~RequestHandler.flush()` must only be called from the main thread.  If
you use multiple threads it is important to use `.IOLoop.add_callback`
to transfer control back to the main thread before finishing the
request.

i(tabsolute_importtdivisiontprint_functiontwith_statementN(tBytesIO(tFuturet	is_future(tescape(tgen(thttputil(tiostream(tlocale(t
access_logtapp_logtgen_log(t
stack_context(ttemplate(tutf8t_unicode(t
import_objectt
ObjectDicttraise_exc_infotunicode_typet_websocket_mask(tsplit_host_and_port(t	urlencodeiitRequestHandlercB�s�eZdZd_ZiZej�Zej	d�Z
d	�Zd
�Ze
d��Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd`d�Zd�Zd�Zd�Zd�Z ej	d�Z!d�Z"gZ#e#e$d�Z%e$d �Z&e#e$d!�Z'e$d"�Z(e#e$d#�Z)e$d$�Z*e$d%�Z+e$d&�Z,d`d'�Z-e
d(��Z.d`d)�Z/d`d`d*d`d+�Z0d*d`d,�Z1d*d`d-�Z2d.d`d/�Z3d`d0�Z4d`d1d`d2�Z5d`d3�Z6e7d`d4�Z8d5�Z9d6�Z:d7�Z;d8�Z<d9�Z=e7d`d:�Z>d`d;�Z?d<d=�Z@d>�ZAe
d?��ZBeBjCd@��ZBdA�ZDdBdC�ZEe
dD��ZFeFjCdE��ZFdF�ZGdG�ZHdH�ZIe
dI��ZJdJ�ZKdK�ZLdL�ZMdM�ZNd`dN�ZOdOdP�ZPdQ�ZQdR�ZRdS�ZSdT�ZTdU�ZUeVjWdV��ZXdW�ZYdX�ZZdY�Z[dZ�Z\d[�Z]d\�Z^d]�Z_d^�Z`RS(as�Base class for HTTP request handlers.

    Subclasses must define at least one of the methods defined in the
    "Entry points" section below.
    tGETtHEADtPOSTtDELETEtPATCHtPUTtOPTIONSs[\x00-\x08\x0e-\x1f]c�s�tt��j�|�_|�_t�_t�_t�_	d�_d�_d�_
d�_t�fd�|jj�D���_t�|j��jd<�jd�jd<�j��jjj�j��j|�dS(Nc3�s*|] \}}|�j|�fVqdS(N(t
_ui_method(t.0tntm(tself(s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>�st_tt_modulestmodules(tsuperRt__init__tapplicationtrequesttFalset_headers_writtent	_finishedtTruet_auto_finishtNonet_transformst_prepared_futuret	path_argstpath_kwargsRt
ui_methodstitemstuit_UIModuleNamespacet
ui_modulestcleart
connectiontset_close_callbackton_connection_closet
initialize(R&R+R,tkwargs((R&s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*�s$									
cC�sdS(s
Hook for subclass initialization.

        A dictionary passed as the third argument of a url spec will be
        supplied as keyword arguments to initialize().

        Example::

            class ProfileHandler(RequestHandler):
                def initialize(self, database):
                    self.database = database

                def get(self, username):
                    ...

            app = Application([
                (r'/user/(.*)', ProfileHandler, dict(database=database)),
                ])
        N((R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR@�scC�s
|jjS(s@An alias for `self.application.settings <Application.settings>`.(R+tsettings(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRB�scO�std��dS(Ni�(t	HTTPError(R&targsRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pythead�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytpost�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytdelete�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytpatch�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytput�scO�std��dS(Ni�(RC(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytoptions�scC�sdS(sCalled at the beginning of a request before  `get`/`post`/etc.

        Override this method to perform common initialization regardless
        of the request method.

        Asynchronous support: Decorate this method with `.gen.coroutine`
        or `.return_future` to make it asynchronous (the
        `asynchronous` decorator cannot be used on `prepare`).
        If this method returns a `.Future` execution will not proceed
        until the `.Future` is done.

        .. versionadded:: 3.1
           Asynchronous support.
        N((R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pytprepare�scC�sdS(sCalled after the end of a request.

        Override this method to perform cleanup, logging, etc.
        This method is a counterpart to `prepare`.  ``on_finish`` may
        not produce any output, as it is called after the response
        has been sent to the client.
        N((R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt	on_finish�scC�sTt|j�rP|jjj�sP|jjjtj��|jjj�qPndS(sFCalled in async handlers if the client closed the connection.

        Override this to clean up resources associated with
        long-lived connections.  Note that this method is called only if
        the connection was closed during asynchronous processing; if you
        need to do cleanup after every request override `on_finish`
        instead.

        Proxies may keep a connection open for a time (perhaps
        indefinitely) after the client has gone away, so this method
        may not be called promptly after the end user closes their
        connection.
        N(	t_has_stream_request_bodyt	__class__R,tbodytdonet
set_exceptionR
tStreamClosedErrort	exception(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR?scC�smtjidtjd6dd6tjtj��d6�|_|j�g|_d|_	tj
d|_dS(s1Resets all headers and content for this response.sTornadoServer/%stServerstext/html; charset=UTF-8sContent-TypetDatei�N(R	tHTTPHeadersttornadotversiontformat_timestampttimet_headerstset_default_headerst
_write_buffert_status_codet	responsest_reason(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR<s	
		cC�sdS(sBOverride this to set HTTP headers at the beginning of the request.

        For example, this is the place to set a custom ``Server`` header.
        Note that setting such headers in the normal flow of request
        processing may not do what you want, since headers may be reset
        during error handling.
        N((R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR]#scC�se||_|dk	r*tj|�|_n7ytj||_Wn tk
r`td|��nXdS(s�Sets the status code for our response.

        :arg int status_code: Response status code. If ``reason`` is ``None``,
            it must be present in `httplib.responses <http.client.responses>`.
        :arg string reason: Human-readable reason phrase describing the status
            code. If ``None``, it will be filled in from
            `httplib.responses <http.client.responses>`.
        sunknown status code %dN(	R_R2Rt
native_strRaR	R`tKeyErrort
ValueError(R&tstatus_codetreason((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
set_status-s		
cC�s|jS(s)Returns the status code for our response.(R_(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
get_status?scC�s|j|�|j|<dS(sSets the given response header name and value.

        If a datetime is given, we automatically format it according to the
        HTTP specification. If the value is not a string, we convert it to
        a string. All header values are then encoded as UTF-8.
        N(t_convert_header_valueR\(R&tnametvalue((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
set_headerCscC�s |jj||j|��dS(s�Adds the given response header and value.

        Unlike `set_header`, `add_header` may be called multiple times
        to return multiple values for the same header.
        N(R\taddRi(R&RjRk((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
add_headerLscC�s ||jkr|j|=ndS(s�Clears an outgoing header, undoing a previous `set_header` call.

        Note that this method does not apply to multi-valued headers
        set by `add_header`.
        N(R\(R&Rj((s1/usr/lib64/python2.7/site-packages/tornado/web.pytclear_headerTss[\x00-\x1f]cC�s�t|t�rnlt|t�r3|jd�}nKt|tj�rOt|�St|tj�rntj	|�St
d|��t|�dks�tj
j|�r�td|��n|S(Nsutf-8sUnsupported header value %ri�sUnsafe header value %r(t
isinstancetbytesRtencodetnumberstIntegraltstrtdatetimeR	RZt	TypeErrortlenRt_INVALID_HEADER_CHAR_REtsearchRd(R&Rk((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRi_s

cC�s|j|||jj|�S(s\Returns the value of the argument with the given name.

        If default is not provided, the argument is considered to be
        required, and we raise a `MissingArgumentError` if it is missing.

        If the argument appears in the url more than once, we return the
        last value.

        The returned value is always unicode.
        (t
_get_argumentR,t	arguments(R&Rjtdefaulttstrip((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_argumentuscC�s.t|t�st�|j||jj|�S(s�Returns a list of the arguments with the given name.

        If the argument is not present, returns an empty list.

        The returned values are always unicode.
        (RptbooltAssertionErrort_get_argumentsR,R|(R&RjR~((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
get_arguments�scC�s|j|||jj|�S(s�Returns the value of the argument with the given name
        from the request body.

        If default is not provided, the argument is considered to be
        required, and we raise a `MissingArgumentError` if it is missing.

        If the argument appears in the url more than once, we return the
        last value.

        The returned value is always unicode.

        .. versionadded:: 3.2
        (R{R,tbody_arguments(R&RjR}R~((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_body_argument�scC�s|j||jj|�S(s�Returns a list of the body arguments with the given name.

        If the argument is not present, returns an empty list.

        The returned values are always unicode.

        .. versionadded:: 3.2
        (R�R,R�(R&RjR~((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_body_arguments�s	cC�s|j|||jj|�S(s�Returns the value of the argument with the given name
        from the request query string.

        If default is not provided, the argument is considered to be
        required, and we raise a `MissingArgumentError` if it is missing.

        If the argument appears in the url more than once, we return the
        last value.

        The returned value is always unicode.

        .. versionadded:: 3.2
        (R{R,tquery_arguments(R&RjR}R~((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_query_argument�scC�s|j||jj|�S(s�Returns a list of the query arguments with the given name.

        If the argument is not present, returns an empty list.

        The returned values are always unicode.

        .. versionadded:: 3.2
        (R�R,R�(R&RjR~((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_query_arguments�s	cC�sH|j||d|�}|s@||jkr<t|��n|S|dS(NR~i����(R�t_ARG_DEFAULTtMissingArgumentError(R&RjR}tsourceR~RD((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR{�scC�s�g}xx|j|g�D]d}|j|d|�}t|t�r[tjjd|�}n|rp|j�}n|j|�qW|S(NRjt (	RFtdecode_argumentRpRRt_remove_control_chars_regextsubR~tappend(R&RjR�R~tvaluestv((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��scC�sIyt|�SWn4tk
rDtdd|p0d|d f��nXdS(sDecodes an argument from the request.

        The argument has been percent-decoded and is now a byte string.
        By default, this method decodes the argument as utf-8 and returns
        a unicode string, but this may be overridden in subclasses.

        This method is used as a filter for both `get_argument()` and for
        values extracted from the url and passed to `get()`/`post()`/etc.

        The name of the argument is provided if known, but may be None
        (e.g. for unnamed groups in the url regex).
        i�sInvalid unicode in %s: %rturli(N(RtUnicodeDecodeErrorRC(R&RkRj((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s


	cC�s
|jjS(sRAn alias for
        `self.request.cookies <.httputil.HTTPServerRequest.cookies>`.(R,tcookies(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��scC�s9|jjdk	r5||jjkr5|jj|jS|S(s?Gets the value of the cookie with the given name, else default.N(R,R�R2Rk(R&RjR}((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
get_cookie�s$t/cK�sttj|�}tj|�}tjd||�rMtd||f��nt|d�sntj�|_n||jkr�|j|=n||j|<|j|}|r�||d<n|dk	r�|r�t
j
j�t
jd|�}n|rt
j|�|d<n|r||d<nxR|j�D]D\}	}
|	dkrId	}	n|	d
krb|
rbq(n|
||	<q(WdS(s�Sets the given cookie name/value with the given options.

        Additional keyword arguments are set on the Cookie.Morsel
        directly.
        See http://docs.python.org/library/cookie.html#morsel-objects
        for available attributes.
        s[\x00-\x20]sInvalid cookie %r: %rt_new_cookietdomaintdaystexpirestpathtmax_agesmax-agethttponlytsecureN(R�R�(RRbtreRzRdthasattrtCookietSimpleCookieR�R2Rvtutcnowt	timedeltaR	RZR8(R&RjRkR�R�R�texpires_daysRAtmorseltkR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
set_cookie�s2






	c
C�sHtjj�tjdd�}|j|ddd|d|d|�dS(	s;Deletes the cookie with the given name.

        Due to limitations of the cookie protocol, you must pass the same
        path and domain to clear a cookie as were used when that cookie
        was set (but there is no way to find out on the server side
        which values were used for a given cookie).
        R�imRktR�R�R�N(RvR�R�R�(R&RjR�R�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pytclear_cookie&scC�s4x-|jjD]}|j|d|d|�q
WdS(s�Deletes all the cookies the user sent with this request.

        See `clear_cookie` for more information on the path and domain
        parameters.

        .. versionchanged:: 3.2

           Added the ``path`` and ``domain`` parameters.
        R�R�N(R,R�R�(R&R�R�Rj((s1/usr/lib64/python2.7/site-packages/tornado/web.pytclear_all_cookies2s
icK�s/|j||j||d|�d||�dS(sSigns and timestamps a cookie so it cannot be forged.

        You must specify the ``cookie_secret`` setting in your Application
        to use this method. It should be a long, random sequence of bytes
        to be used as the HMAC secret for the signature.

        To read a cookie set with this method, use `get_secure_cookie()`.

        Note that the ``expires_days`` parameter sets the lifetime of the
        cookie in the browser, but is independent of the ``max_age_days``
        parameter to `get_secure_cookie`.

        Secure cookies may contain arbitrary byte values, not just unicode
        strings (unlike regular cookies)

        .. versionchanged:: 3.2.1

           Added the ``version`` argument.  Introduced cookie version 2
           and made it the default.
        RYR�N(R�tcreate_signed_value(R&RjRkR�RYRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pytset_secure_cookie?s	cC�s�|jdd�|jjd}d}t|t�rr|jjjd�dkr_td��n|jjd}nt|||d|d|�S(s�Signs and timestamps a string so it cannot be forged.

        Normally used via set_secure_cookie, but provided as a separate
        method for non-cookie uses.  To decode a value not stored
        as a cookie use the optional value argument to get_secure_cookie.

        .. versionchanged:: 3.2.1

           Added the ``version`` argument.  Introduced cookie version 2
           and made it the default.
        t
cookie_secretssecure cookiestkey_versions5key_version setting must be used for secret_key dictsRYN(	trequire_settingR+RBR2RptdictRFt	ExceptionR�(R&RjRkRYtsecretR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�YsicC�sT|jdd�|dkr.|j|�}nt|jjd||d|d|�S(sKReturns the given signed cookie if it validates, or None.

        The decoded cookie value is returned as a byte string (unlike
        `get_cookie`).

        .. versionchanged:: 3.2.1

           Added the ``min_version`` argument.  Introduced cookie version 2;
           both versions 1 and 2 are accepted by default.
        R�ssecure cookiestmax_age_daystmin_versionN(R�R2R�tdecode_signed_valueR+RB(R&RjRkR�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_secure_cookiepscC�s8|jdd�|dkr.|j|�}nt|�S(sgReturns the signing key version of the secure cookie.

        The version is returned as int.
        R�ssecure cookiesN(R�R2R�tget_signature_key_version(R&RjRk((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_secure_cookie_key_version�scC�s�|jrtd��n|dkr9|r0dnd}n1t|t�rdd|ko_dknsjt�|j|�|jdt|��|j	�dS(s:Sends a redirect to the given (optionally relative) URL.

        If the ``status`` argument is specified, that value is used as the
        HTTP status code; otherwise either 301 (permanent) or 302
        (temporary) is chosen based on the ``permanent`` argument.
        The default is 302 (temporary).
        s/Cannot redirect after headers have been writteni-i.i,i�tLocationN(
R.R�R2RptintR�RgRlRtfinish(R&R�t	permanenttstatus((s1/usr/lib64/python2.7/site-packages/tornado/web.pytredirect�s	1
cC�s�|jrtd��nt|tttf�sad}t|t�rR|d7}nt|��nt|t�r�tj	|�}|j
dd�nt|�}|jj
|�dS(s�Writes the given chunk to the output buffer.

        To write the output to the network, use the flush() method below.

        If the given chunk is a dictionary, we write it as JSON and set
        the Content-Type of the response to be ``application/json``.
        (if you want to send JSON as a different ``Content-Type``, call
        set_header *after* calling write()).

        Note that lists are not converted to JSON because of a potential
        cross-site security vulnerability.  All JSON output should be
        wrapped in a dictionary.  More details at
        http://haacked.com/archive/2009/06/25/json-hijacking.aspx/ and
        https://github.com/facebook/tornado/issues/1009
        sCannot write() after finish()s5write() only accepts bytes, unicode, and dict objectss|. Lists not accepted for security reasons; see http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.writesContent-Typesapplication/json; charset=UTF-8N(R/tRuntimeErrorRpRqRR�tlistRwRtjson_encodeRlRR^R�(R&tchunktmessage((s1/usr/lib64/python2.7/site-packages/tornado/web.pytwrite�s	
cK�s|j||�}g}g}g}g}g}g}	xNt|di�j�D]4}
|
j�}|r}|jt|��n|
j�}|r�t|tt	f�r�|j|�q�|j
|�n|
j�}|r�|jt|��n|
j�}|r3t|tt	f�r#|j|�q3|j
|�n|
j
�}
|
r[|jt|
��n|
j�}|rO|	jt|��qOqOWd�}|rHg}t�}xU|D]M}||�s�|j|�}n||kr�|j|�|j|�q�q�Wdjd�|D��}|jd�}|| t|�d||}n|r�ddj|�d}|jd�}|| |d||}n|rIg}t�}xU|D]M}||�s�|j|�}n||kr�|j|�|j|�q�q�Wdjd	�|D��}|jd
�}|| t|�d||}n|r�ddj|�d}|jd
�}|| |d||}n|r�|jd
�}|| dj|�d||}n|	r|jd�}|| dj|	�d||}n|j|�d
S(s>Renders the template with the given arguments as the response.t_active_modulesc�s#t�fd�dddgD��S(Nc3�s|]}�j|�VqdS(N(t
startswith(R#tx(R�(s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>�sR�shttp:shttps:(tany(R�((R�s1/usr/lib64/python2.7/site-packages/tornado/web.pytis_absolute�sR�cs�s&|]}dtj|�dVqdS(s
<script src="s"" type="text/javascript"></script>N(Rtxhtml_escape(R#tp((s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>�ss</body>s
s,<script type="text/javascript">
//<![CDATA[
s
//]]>
</script>cs�s&|]}dtj|�dVqdS(s<link href="s$" type="text/css" rel="stylesheet"/>N(RR�(R#R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>ss</head>s<style type="text/css">
s	
</style>N(t
render_stringtgetattrR�tembedded_javascriptR�Rtjavascript_filesRpRRqtextendtembedded_csst	css_filest	html_headt	html_bodytsett
static_urlRmtjointrindextindexR�(R&t
template_nameRAthtmltjs_embedtjs_filest	css_embedR�t
html_headsthtml_bodiestmodulet
embed_partt	file_partt	head_partt	body_partR�tpathstunique_pathsR�tjstsloctcssthloc((s1/usr/lib64/python2.7/site-packages/tornado/web.pytrender�s�		


#	


#&&c	K�s�|j�}|sjtjd�}|jj}x|jj|krN|j}q0Wtjj|jj�}nt	j
�@|t	jkr�|j|�}|t	j|<n
t	j|}WdQX|j
|�}|j�}|j|�|j|�S(s�Generate the given template with the given arguments.

        We return the generated byte string (in utf8). To generate and
        write a template as a response, use render() above.
        iN(tget_template_pathtsyst	_getframetf_codetco_filenametf_backtosR�tdirnameRt_template_loader_lockt_template_loaderstcreate_template_loadertloadtget_template_namespacetupdatetgenerate(	R&R�RAt
template_pathtframetweb_filetloaderttt	namespace((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s 


cC�sqtd|d|jd|jd|jd|jjd|jjd|jd|jd	|j�	}|j	|j
�|S(
sBReturns a dictionary to be used as the default template namespace.

        May be overridden by subclasses to add or modify values.

        The results of this method will be combined with additional
        defaults in the `tornado.template` module and keyword arguments
        to `render` or `render_string`.
        thandlerR,tcurrent_userRt_tpgettextR�txsrf_form_htmltreverse_url(R�R,RRt	translateRR�R	R
R�R9(R&R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�,s						cC�sS|jj}d|kr |dSi}d|krC|d|d<ntj||�S(s8Returns a new template loader for the given path.

        May be overridden by subclasses.  By default returns a
        directory-based loader on the given path, using the
        ``autoescape`` application setting.  If a ``template_loader``
        application setting is supplied, uses that instead.
        ttemplate_loadert
autoescape(R+RBRtLoader(R&R�RBRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�CscC�szdj|j�}g|_|jst|_x>|jD]3}|j|j|j||�\|_|_}q7W|jj	dkr�d}nt|d�r�x3|jj
�D]}|jd|jd��q�Wntjd|j|j�}|jjj||j|d|�Sx#|jD]}|j||�}qW|jj	dkr\|jjj|d|�St�}|jd�|SdS(s�Flushes the current output buffer to the network.

        The ``callback`` argument, if given, can be used for flow control:
        it will be run when all flushed data has been written to the socket.
        Note that only one flush callback can be outstanding at a time;
        if another flush occurs before the previous flush's callback
        has been run, the previous callback will be discarded.

        .. versionchanged:: 4.0
           Now returns a `.Future` if no callback is given.
        R�RR�s
Set-CookietcallbackN(R�R^R.R0R3ttransform_first_chunkR_R\R,tmethodR2R�R�R�RntOutputStringR	tResponseStartLineRaR=t
write_headersttransform_chunkR�Rt
set_result(R&tinclude_footersRR�t	transformtcookiet
start_linetfuture((s1/usr/lib64/python2.7/site-packages/tornado/web.pytflushUs2				 		
cC�s~|jrtd��n|dk	r4|j|�n|js|jdkr�|jjd
kr�d|jkr�|j	�|j
�r�g|_|jd�q�n|jdkr�|js�t
d��|j�qd|jkrtd	�|jD��}|jd|�qnt|jd
�r7|jjjd�n|jdt�|jj�|j�t|_|j�d|_dS(s0Finishes this response, ending the HTTP request.sfinish() called twicei�RRtEtagi0sCannot send body with 304sContent-Lengthcs�s|]}t|�VqdS(N(Rx(R#tpart((s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>�sR=RN(RsHEAD(R/R�R2R�R.R_R,RR\tset_etag_headertcheck_etag_headerR^RgR�t_clear_headers_for_304tsumRlR�R=R>RR0R�t_logRMR9(R&R�tcontent_length((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s4		
	


	
i�cK�s|jr[tjd�|jsWy|j�WqWtk
rStjddt�qWXndS|j�|jd�}d|kr�|dd}t	|t
�r�|jr�|j}q�n|j|d|�y|j
||�Wn$tk
rtjddt�nX|js|j�ndS(s�Sends the given HTTP error code to the browser.

        If `flush()` has already been called, it is not possible to send
        an error, so this method will simply terminate the response.
        If output has been written but not yet flushed, it will be discarded
        and replaced with the error page.

        Override `write_error()` to customize the error page that is returned.
        Additional keyword arguments are passed through to `write_error`.
        s0Cannot send error response after headers writtens Failed to flush partial responsetexc_infoNRfis!Uncaught exception in write_error(R.RterrorR/R�R�R0R<RFRpRCRfRgtwrite_errorR
(R&ReRARfRT((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
send_error�s,	
	


	cK�s�|jjd�rfd|krf|jdd�x(tj|d�D]}|j|�qBW|j�n"|jdi|d6|jd6�dS(	s�Override to implement custom error pages.

        ``write_error`` may call `write`, `render`, `set_header`, etc
        to produce output as usual.

        If this error was caused by an uncaught exception (including
        HTTPError), an ``exc_info`` triple will be available as
        ``kwargs["exc_info"]``.  Note that this exception may not be
        the "current" exception for purposes of methods like
        ``sys.exc_info()`` or ``traceback.format_exc``.
        tserve_tracebackR%sContent-Types
text/plainsS<html><title>%(code)d: %(message)s</title><body>%(code)d: %(message)s</body></html>tcodeR�N(RBRFRlt	tracebacktformat_exceptionR�R�Ra(R&ReRAtline((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR'�s
	cC�sRt|d�sK|j�|_|jsK|j�|_|jsHt�qKn|jS(s^The locale for the current session.

        Determined by either `get_user_locale`, which you can override to
        set the locale based on, e.g., a user preference stored in a
        database, or `get_browser_locale`, which uses the ``Accept-Language``
        header.

        .. versionchanged: 4.1
           Added a property setter.
        t_locale(R�tget_user_localeR.tget_browser_localeR�(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s	cC�s
||_dS(N(R.(R&Rk((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRscC�sdS(sOverride to determine the locale from the authenticated user.

        If None is returned, we fall back to `get_browser_locale()`.

        This method should return a `tornado.locale.Locale` object,
        most likely obtained via a call like ``tornado.locale.get("en")``
        N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR/sten_USc	C�s-d|jjkr |jjdjd�}g}x�|D]�}|j�jd�}t|�dkr�|djd�r�yt|dd�}Wq�ttfk
r�d}q�Xnd}|j	|d	|f�q8W|r |j
d
d�dt�g|D]}|d	^q�}tj
|�Sntj
|�S(
s�Determines the user's locale from ``Accept-Language`` header.

        See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
        sAccept-Languaget,t;isq=igg�?itkeycS�s|dS(Ni((tpair((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt<lambda>"streverse(R,theaderstsplitR~RxR�tfloatRdRwR�tsortR0RRF(	R&R}t	languagestlocalestlanguagetpartstscoretltcodes((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR0s"
%
cC�s(t|d�s!|j�|_n|jS(ssThe authenticated user for this request.

        This is a cached version of `get_current_user`, which you can
        override to set the user based on, e.g., a cookie. If that
        method is not overridden, this method always returns None.

        We lazy-load the current user the first time this method is called
        and cache the result after that.
        t
_current_user(R�tget_current_userRC(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR'scC�s
||_dS(N(RC(R&Rk((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR6scC�sdS(s<Override to determine the current user from, e.g., a cookie.N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRD:scC�s|jdd�|jjdS(s�Override to customize the login URL based on the request.

        By default, we use the ``login_url`` application setting.
        t	login_urls@tornado.web.authenticated(R�R+RB(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
get_login_url>scC�s|jjjd�S(s�Override to customize template path for each handler.

        By default, we use the ``template_path`` application setting.
        Return None to load templates relative to the calling file.
        R�(R+RBRF(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�FscC�st|d�s|j�\}}}|jjdd�}|dkrZtj|�|_nx|dkr�tjd�}dj	dtj|�tjt
||��ttt
|���g�|_ntd|��|dkr|jr�d	nd}|jd
|jd|�qn|jS(
slThe XSRF-prevention token for the current user/session.

        To prevent cross-site request forgery, we set an '_xsrf' cookie
        and include the same '_xsrf' value as an argument with all POST
        requests. If the two do not match, we reject the form submission
        as a potential forgery.

        See http://en.wikipedia.org/wiki/Cross-site_request_forgery

        .. versionchanged:: 3.2.2
           The xsrf token will now be have a random mask applied in every
           request, which makes it safe to include the token in pages
           that are compressed.  See http://breachattack.com for more
           information on the issue fixed by this change.  Old (version 1)
           cookies will be converted to version 2 when this method is called
           unless the ``xsrf_cookie_version`` `Application` setting is
           set to 1.
        t_xsrf_tokentxsrf_cookie_versioniiit|t2sunknown xsrf cookie version %dit_xsrfR�N(R�t_get_raw_xsrf_tokenRBRFtbinasciitb2a_hexRGR�turandomR�RRRuR�RdR2RR�(R&RYttokent	timestamptoutput_versiontmaskR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
xsrf_tokenNs&$	
cC�s�t|d�s�|jd�}|r?|j|�\}}}nd\}}}|dkr~d}tjd�}tj�}n|||f|_n|jS(s�Read or generate the xsrf token in its raw form.

        The raw_xsrf_token is a tuple containing:

        * version: the version of the cookie from which this token was read,
          or None if we generated a new token in this request.
        * token: the raw token data; random (non-ascii) bytes.
        * timestamp: the time this token was generated (will not be accurate
          for version 1 cookies)
        t_raw_xsrf_tokenRKiN(NNN(R�R�t_decode_xsrf_tokenR2R�ROR[RU(R&RRYRPRQ((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRLwsc	C�sIytjt|��}|r�t|jd��}|dkr�|jd�\}}}}tjt|��}t|tjt|���}t|�}|||fSt	d��ngd}ytjt|��}Wn&tj
tfk
r�t|�}nXttj��}|||fSWn%t	k
rDt
jddt�dSXdS(	s_Convert a cookie string into a the tuple form returned by
        _get_raw_xsrf_token.
        iiRIsUnknown xsrf cookie versions(Uncaught exception in _decode_xsrf_tokenR%N(NNN(t_signed_value_version_retmatchRR�tgroupR9RMta2b_hexRR�tErrorRwR[RtdebugR0R2(	R&RR%RYRRStmasked_tokenRQRP((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRV�s.

cC�s�|jdd�p9|jjjd�p9|jjjd�}|sTtdd��n|j|�\}}}|j�\}}}tt	|�t	|��s�tdd��ndS(s�Verifies that the ``_xsrf`` cookie matches the ``_xsrf`` argument.

        To prevent cross-site request forgery, we set an ``_xsrf``
        cookie and include the same value as a non-cookie
        field with all ``POST`` requests. If the two do not match, we
        reject the form submission as a potential forgery.

        The ``_xsrf`` value may be set as either a form field named ``_xsrf``
        or in a custom HTTP header named ``X-XSRFToken`` or ``X-CSRFToken``
        (the latter is accepted for compatibility with Django).

        See http://en.wikipedia.org/wiki/Cross-site_request_forgery

        Prior to release 1.1.1, this check was ignored if the HTTP header
        ``X-Requested-With: XMLHTTPRequest`` was present.  This exception
        has been shown to be insecure and has been removed.  For more
        information please see
        http://www.djangoproject.com/weblog/2011/feb/08/security/
        http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails

        .. versionchanged:: 3.2.2
           Added support for cookie version 2.  Both versions 1 and 2 are
           supported.
        RKsX-XsrftokensX-Csrftokeni�s"'_xsrf' argument missing from POSTs(XSRF cookie does not match POST argumentN(
RR2R,R8RFRCRVRLt_time_independent_equalsR(R&RPRtexpected_token((s1/usr/lib64/python2.7/site-packages/tornado/web.pytcheck_xsrf_cookie�scC�sdtj|j�dS(s�An HTML ``<input/>`` element to be included with all POST forms.

        It defines the ``_xsrf`` input value, which we check on all POST
        requests to prevent cross-site request forgery. If you have set
        the ``xsrf_cookies`` application setting, you must include this
        HTML within all of your HTML forms.

        In a template, this method should be called with ``{% module
        xsrf_form_html() %}``

        See `check_xsrf_cookie()` above for more information.
        s)<input type="hidden" name="_xsrf" value="s"/>(RR�RT(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR	�scK�s�|jdd�|jjdt�j}|dkrIt|dt�}n|rl|jj	d|jj
}nd}|||j||�S(s�Returns a static URL for the given relative static file path.

        This method requires you set the ``static_path`` setting in your
        application (which specifies the root directory of your static
        files).

        This method returns a versioned url (by default appending
        ``?v=<signature>``), which allows the static files to be
        cached indefinitely.  This can be disabled by passing
        ``include_version=False`` (in the default implementation;
        other static file implementations are not required to support
        this, but they may support other options).

        By default this method returns URLs relative to the current
        host, but if ``include_host`` is true the URL returned will be
        absolute.  If this handler has an ``include_host`` attribute,
        that value will be used as the default for all `static_url`
        calls that do not pass ``include_host`` as a keyword argument.

        tstatic_pathR�tstatic_handler_classtinclude_hosts://R�N(R�RBRFtStaticFileHandlertmake_static_urlR2R�R-R,tprotocolthost(R&R�RcRAtget_urltbase((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��ssthis featurecC�s2|jjj|�s.td||f��ndS(s<Raises an exception if the given app setting is not defined.s>You must define the '%s' setting in your application to use %sN(R+RBRFR�(R&Rjtfeature((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�	scG�s|jj||�S(s$Alias for `Application.reverse_url`.(R+R
(R&RjRD((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR
scC�s;tj�}x|jD]}|j|�qWd|j�S(sComputes the etag header to be used for this request.

        By default uses a hash of the content written so far.

        May be overridden to provide custom etag implementations,
        or may return None to disable tornado's default etag support.
        s"%s"(thashlibtsha1R^R�t	hexdigest(R&thasherR((s1/usr/lib64/python2.7/site-packages/tornado/web.pytcompute_etagscC�s/|j�}|dk	r+|jd|�ndS(s�Sets the response's Etag header using ``self.compute_etag()``.

        Note: no header will be set if ``compute_etag()`` returns ``None``.

        This method is called automatically when the request is finished.
        RN(RoR2Rl(R&tetag((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR scC�s�t|jjdd��}tjdt|jjjdd���}|sS|rWtSt}|ddkrvt}n<d�}x0|D](}||�||�kr�t}Pq�q�W|S(s�Checks the ``Etag`` header against requests's ``If-None-Match``.

        Returns ``True`` if the request's Etag matches and a 304 should be
        returned. For example::

            self.set_etag_header()
            if self.check_etag_header():
                self.set_status(304)
                return

        This method is called automatically when the request is finished,
        but may be called earlier for applications that override
        `compute_etag` and want to do an early check for ``If-None-Match``
        before completing the request.  The ``Etag`` header should be set
        (perhaps with `set_etag_header`) before calling this method.
        RR�s\*|(?:W/)?"[^"]*"s
If-None-Matchit*cS�s|jd�r|dS|S(NsW/i(R�(R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR6Ks(	RR\RFR�tfindallR,R8R-R0(R&t
computed_etagtetagsRXtvalRp((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR +s!		
cC�s<yt|||f�Wntk
r7|j|�nXtS(N(RR�t_handle_request_exceptionR0(R&ttypeRkR+((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_stack_context_handle_exceptionRs

c/�sa|�_y��jj�jkr0td��ng|D]}�j|�^q7�_t�fd�|j�D���_	�jjdkr��j
jjd�r��j
�n�j�}t|�r�|V}n|dk	r�td|��n�jdk	r�jjd�n�jrdSt�j�rWy�jjVWqWtjk
rSdSXnt��jjj��}|�j�j	�}t|�r�|V}n|dk	r�td|��n�jr��jr��j�nWn}tk
r\}y�j|�Wn$tk
r&t j!d	d
t"�nX�jdk	r]�jj#�r]�jjd�q]nXdS(s7Executes this request with the given output transforms.i�c3�s0|]&\}}|�j|d|�fVqdS(RjN(R�(R#R�R�(R&(s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>esRRR!txsrf_cookiessExpected None, got %rNsException in exception handlerR%(sGETsHEADR!($R3R,RtSUPPORTED_METHODSRCR�R5R�R8R6R+RBRFR`RLRR2RwR4RR/RNRORPR
RSR�tlowerR1R�R�RvR
R&R0RQ(R&t
transformsRDRAtargtresultRte((R&s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_execute]sP	%

	

cC�s
t��dS(swImplement this method to handle streamed request data.

        Requires the `.stream_request_body` decorator.
        N(tNotImplementedError(R&R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
data_received�scC�s|jj|�dS(s�Logs the current request.

        Sort of deprecated since this functionality was moved to the
        Application, but left in place for the benefit of existing apps
        that have overridden this method.
        N(R+tlog_request(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR#�scC�s#d|jj|jj|jjfS(Ns
%s %s (%s)(R,Rturit	remote_ip(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_request_summary�scC�s
t|t�r)|js%|j�ndSy|jtj��Wn$tk
rftj	ddt
�nX|jrtdSt|t�r�|jt
jkr�|jr�tj	d|j�|jddtj��q|j|jdtj��n|jddtj��dS(NsError in exception loggerR%sBad HTTP status code: %di�(RptFinishR/R�t
log_exceptionR�R%R�R
R&R0RCReR	R`RfRR((R&R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRv�s 	

	cC�s�t|t�r]|jr�d|j}|j|j�gt|j�}tj||�q�n+t	j
d|j�|jd|||f�dS(sKOverride to customize logging of uncaught exceptions.

        By default logs instances of `HTTPError` as warnings without
        stack traces (on the ``tornado.general`` logger), and all
        other exceptions as errors with stack traces (on the
        ``tornado.application`` logger).

        .. versionadded:: 3.1
        s%d %s: sUncaught exception %s
%rR%N(RpRCtlog_messageReR�R�RDRtwarningR
R&R,(R&ttypRkttbtformatRD((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s
	
c�s���fd�}|S(Nc�s]t�d�si�_n��jkr@����j�<n�j�j||�}|S(NR�(R�R�R�(RDRAtrendered(R�RjR&(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s((R&RjR�R�((R�RjR&s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
_ui_module�sc�s��fd�S(Nc�s��||�S(N((RDRA(RR&(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR6�s((R&R((RR&s1/usr/lib64/python2.7/site-packages/tornado/web.pyR"�scC�s@ddddddddg}x|D]}|j|�q%WdS(	NtAllowsContent-EncodingsContent-LanguagesContent-LengthsContent-MD5s
Content-RangesContent-Types
Last-Modified(Ro(R&R8th((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR!�s
		
(sGETsHEADRRRR sOPTIONSN(at__name__t
__module__t__doc__RzR�t	threadingtLockR�R�tcompileR�R*R@tpropertyRBRERFRGRHRIRJRKRLRMR?R<R]R2RgRhRlRnRoRyRiR�R0RR�R�R�R�R�R{R�R�R�R�R�R�R�R�R�R�R�R-R�R�R�R�R�R�RR�R(R'RtsetterR/R0RRDRFR�RTRLRVR`R	R�R�R
RoRR RxRt	coroutineR�R�R#R�RvR�R�R"R!(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s�											
			
							

	(
		V			0)'		
			)		$	#	#		
		'	:							
	c�s5ddlm�tj����fd��}|S(sWrap request handler methods with this if they are asynchronous.

    This decorator is for callback-style asynchronous methods; for
    coroutines, use the ``@gen.coroutine`` decorator without
    ``@asynchronous``. (It is legal for legacy reasons to use the two
    decorators together provided ``@asynchronous`` is first, but
    ``@asynchronous`` will be ignored in this case)

    This decorator should only be applied to the :ref:`HTTP verb
    methods <verbs>`; its behavior is undefined for any other method.
    This decorator does not *make* a method asynchronous; it tells
    the framework that the method *is* asynchronous.  For this decorator
    to be useful the method must (at least sometimes) do something
    asynchronous.

    If this decorator is given, the response is not finished when the
    method returns. It is up to the request handler to call
    `self.finish() <RequestHandler.finish>` to finish the HTTP
    request. Without this decorator, the request is automatically
    finished when the ``get()`` or ``post()`` method returns. Example:

    .. testcode::

       class MyRequestHandler(RequestHandler):
           @asynchronous
           def get(self):
              http = httpclient.AsyncHTTPClient()
              http.fetch("http://friendfeed.com/", self._on_download)

           def _on_download(self, response):
              self.write("Downloaded!")
              self.finish()

    .. testoutput::
       :hide:

    .. versionadded:: 3.1
       The ability to use ``@gen.coroutine`` without ``@asynchronous``.

    i(tIOLoopc�sqt�_tj�j��P��||�}t|�rc�fd�}�j�j||�dS|SWdQXdS(Nc�s$|j��js �j�ndS(N(R~R/R�(tf(R&(s1/usr/lib64/python2.7/site-packages/tornado/web.pytfuture_complete+s
	(	R-R1RtExceptionStackContextRxRtcurrentt
add_futureR2(R&RDRAR~R�(R�R(R&s1/usr/lib64/python2.7/site-packages/tornado/web.pytwrappers	
(ttornado.ioloopR�t	functoolstwraps(RR�((R�Rs1/usr/lib64/python2.7/site-packages/tornado/web.pytasynchronous�s*!cC�s.t|t�s!td|��nt|_|S(smApply to `RequestHandler` subclasses to enable streaming body support.

    This decorator implies the following changes:

    * `.HTTPServerRequest.body` is undefined, and body arguments will not
      be included in `RequestHandler.get_argument`.
    * `RequestHandler.prepare` is called when the request headers have been
      read instead of after the entire body has been read.
    * The subclass must define a method ``data_received(self, data):``, which
      will be called zero or more times as data is available.  Note that
      if the request has an empty body, ``data_received`` may not be called.
    * ``prepare`` and ``data_received`` may return Futures (such as via
      ``@gen.coroutine``, in which case the next method will not be called
      until those futures have completed.
    * The regular HTTP method (``post``, ``put``, etc) will be called after
      the entire body has been read.

    There is a subtle interaction between ``data_received`` and asynchronous
    ``prepare``: The first call to ``data_received`` may occur at any point
    after the call to ``prepare`` has returned *or yielded*.
    s+expected subclass of RequestHandler, got %r(t
issubclassRRwR0t_stream_request_body(tcls((s1/usr/lib64/python2.7/site-packages/tornado/web.pytstream_request_body:s	cC�s1t|t�s!td|��nt|dt�S(Ns+expected subclass of RequestHandler, got %rR�(R�RRwR�R-(R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRNVsc�s"tj���fd��}|S(s#Use this decorator to remove trailing slashes from the request path.

    For example, a request to ``/foo/`` would redirect to ``/foo`` with this
    decorator. Your request handler mapping should use a regular expression
    like ``r'/foo/*'`` in conjunction with using the decorator.
    c�s�|jjjd�r�|jjdkr|jjjd�}|r�|jjre|d|jj7}n|j|dt�dSq�td��n�|||�S(NR�RRt?R�i�(sGETsHEAD(	R,R�tendswithRtrstriptqueryR�R0RC(R&RDRAR�(R(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�cs(R�R�(RR�((Rs1/usr/lib64/python2.7/site-packages/tornado/web.pytremoveslash\s
c�s"tj���fd��}|S(s&Use this decorator to add a missing trailing slash to the request path.

    For example, a request to ``/foo`` would redirect to ``/foo/`` with this
    decorator. Your request handler mapping should use a regular expression
    like ``r'/foo/?'`` in conjunction with using the decorator.
    c�s�|jjjd�s�|jjdkrq|jjd}|jjrZ|d|jj7}n|j|dt�dStd��n�|||�S(NR�RRR�R�i�(sGETsHEAD(R,R�R�RR�R�R0RC(R&RDRAR�(R(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�zs(R�R�(RR�((Rs1/usr/lib64/python2.7/site-packages/tornado/web.pytaddslashsstApplicationcB�s}eZdZd
dd
d�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(saA collection of request handlers that make up a web application.

    Instances of this class are callable and can be passed directly to
    HTTPServer to serve the application::

        application = web.Application([
            (r"/", MainPageHandler),
        ])
        http_server = httpserver.HTTPServer(application)
        http_server.listen(8080)
        ioloop.IOLoop.current().start()

    The constructor for this class takes in a list of `URLSpec` objects
    or (regexp, request_class) tuples. When we receive requests, we
    iterate over the list in order and instantiate an instance of the
    first request class whose regexp matches the request path.
    The request class can be specified as either a class object or a
    (fully-qualified) name.

    Each tuple can contain additional elements, which correspond to the
    arguments to the `URLSpec` constructor.  (Prior to Tornado 3.2, this
    only tuples of two or three elements were allowed).

    A dictionary may be passed as the third element of the tuple,
    which will be used as keyword arguments to the handler's
    constructor and `~RequestHandler.initialize` method.  This pattern
    is used for the `StaticFileHandler` in this example (note that a
    `StaticFileHandler` can be installed automatically with the
    static_path setting described below)::

        application = web.Application([
            (r"/static/(.*)", web.StaticFileHandler, {"path": "/var/www"}),
        ])

    We support virtual hosts with the `add_handlers` method, which takes in
    a host regular expression as the first argument::

        application.add_handlers(r"www\.myhost\.com", [
            (r"/article/([0-9]+)", ArticleHandler),
        ])

    You can serve static files by sending the ``static_path`` setting
    as a keyword argument. We will serve those files from the
    ``/static/`` URI (this is configurable with the
    ``static_url_prefix`` setting), and we will serve ``/favicon.ico``
    and ``/robots.txt`` from the same directory.  A custom subclass of
    `StaticFileHandler` can be specified with the
    ``static_handler_class`` setting.

    R�cK�s0|dkrIg|_|jd�s3|jd�rR|jjt�qRn	||_g|_i|_||_||_it	d6t
d6td6|_i|_
|j|jdi��|j|jdi��|jjd�r�|jd}t|p�g�}|jd	d
�}|jdt�}|jdi�}||d
<x@tj|�dddgD]}	|jd|	||f�q]Wn|r�|jd|�n|jjd�r�|jjdt�|jjdt�|jjdt�|jjdt�n|jjd�r,ddlm}
|
j�ndS(Ntcompress_responsetgziptlinkifyR	tTemplateR;R7Ratstatic_url_prefixs/static/Rbtstatic_handler_argsR�s(.*)s/(favicon\.ico)s/(robots\.txt)is.*$R\t
autoreloadtcompiled_template_cachetstatic_hash_cacheR)(R�(R2R|RFR�tGZipContentEncodingthandlerstnamed_handlerstdefault_hostRBt_linkifyt_xsrf_form_htmltTemplateModuleR;R7t_load_ui_modulest_load_ui_methodsR�RdR�Rtinserttadd_handlerst
setdefaultR0R-RXR�tstart(R&R�R�R|RBR�R�RbR�tpatternR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*�sL						

	
				
cK�s3ddlm}|||�}|j||�dS(sxStarts an HTTP server for this application on the given port.

        This is a convenience alias for creating an `.HTTPServer`
        object and calling its listen method.  Keyword arguments not
        supported by `HTTPServer.listen <.TCPServer.listen>` are passed to the
        `.HTTPServer` constructor.  For advanced uses
        (e.g. multi-process mode), do not use this method; create an
        `.HTTPServer` and call its
        `.TCPServer.bind`/`.TCPServer.start` methods directly.

        Note that after calling this method you still need to call
        ``IOLoop.current().start()`` to start the server.
        i(t
HTTPServerN(ttornado.httpserverR�tlisten(R&tporttaddressRAR�tserver((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��scC�s+|jd�s|d7}ng}|jrj|jddjdkrj|jjdtj|�|f�n|jjtj|�|f�x�|D]�}t|tt	f�r�t
|�d
ks�t�t|�}n|j|�|j
r�|j
|jkrtjd|j
�n||j|j
<q�q�Wd	S(s�Appends the given handlers to our handler list.

        Host patterns are processed sequentially in the order they were
        added. All matching patterns will be considered.
        t$i����is.*$iiis4Multiple handlers named %s; replacing previous valueN(iii(R�R�R�R�R�R�R�RpttupleR�RxR�tURLSpecRjR�R
R�(R&thost_patternt
host_handlersR�tspec((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s"
#%

	
cC�s|jj|�dS(N(R|R�(R&ttransform_class((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
add_transformscC�s�t|jj��d}g}x6|jD]+\}}|j|�r)|j|�q)q)W|r�d|jkr�x<|jD].\}}|j|j�rx|j|�qxqxWn|p�dS(Nis	X-Real-Ip(	RRgR{R�RXR�R8R�R2(R&R,RgtmatchesR�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_get_host_handlerssc�s�t�tj�r>|jt�fd�t��D���n�t�t�rnx��D]}|j|�qTWnfxc�j�D]U\}}|jd�r{t	|d�r{|dj
�|dkr{||j|<q{q{WdS(Nc3�s$|]}|t�|�fVqdS(N(R�(R#R$(tmethods(s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>.sRt__call__i(Rpttypest
ModuleTypeR�R�tdirR�R8R�R�R{R7(R&R�R%Rjtfn((R�s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�,s
c�s�t�tj�r>|jt�fd�t��D���n�t�t�rnx��D]}|j|�qTWnit�t�s�t�xQ�j�D]C\}}y#t	|t
�r�||j|<nWq�tk
r�q�Xq�WdS(Nc3�s$|]}|t�|�fVqdS(N(R�(R#R$(R((s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>;s(
RpR�R�R�R�R�R�R�R8R�tUIModuleR;Rw(R&R(R%RjR�((R(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�9s

cC�s
t||�S(N(t_RequestDispatcher(R&tserver_conntrequest_conn((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
start_requestIscC�s&t|d�}|j|�|j�S(N(R�R2tset_requesttexecute(R&R,t
dispatcher((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�Ms
cG�s7||jkr#|j|j|�Std|��dS(s3Returns a URL path for handler named ``name``

        The handler must be added to the application as a named `URLSpec`.

        Args will be substituted for capturing groups in the `URLSpec` regex.
        They will be converted to strings if necessary, encoded as utf8,
        and url-escaped.
        s%s not found in named urlsN(R�R7Rc(R&RjRD((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR
Ss	cC�s�d|jkr$|jd|�dS|j�dkrBtj}n'|j�dkr`tj}n	tj}d|jj�}|d|j�|j�|�dS(s!Writes a completed HTTP request to the logs.

        By default writes to the python root logger.  To change
        this behavior either subclass Application and override this method,
        or pass a function in the application settings dictionary as
        ``log_function``.
        tlog_functionNi�i�g@�@s%d %s %.2fms(	RBRhRtinfoR�R&R,trequest_timeR�(R&Rt
log_methodR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�`s	N(R�R�R�R2R*R�R�R�R�R�R�R�R�R
R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s2.			
	
				
R�cB�sPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cC�sL||_||_d|_g|_d|_d|_g|_i|_dS(N(	R+R=R2R,tchunkst
handler_classthandler_kwargsR5R6(R&R+R=((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*ws							cC�sN|jtjd|jd|d|��|jrJt�|j_|j�SdS(NR=RR8(	R�R	tHTTPServerRequestR=R�RR,RPR�(R&RR8((s1/usr/lib64/python2.7/site-packages/tornado/web.pytheaders_received�s
	cC�s)||_|j�t|j�|_dS(N(R,t
_find_handlerRNR�R�(R&R,((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s	
cC�se|j}|j|j�}|sSt|_tdd|jj|jf�|_dSx�|D]�}|j	j
|jj�}|rZ|j|_|j|_|j	j
r|j	jr�td�|j�j�D��|_qg|j
�D]}t|�^q�|_ndSqZW|jjd�rF|jd|_|jjdi�|_nt|_tdd�|_dS(NR�s%s://%s/cs�s-|]#\}}t|�t|�fVqdS(N(Rut_unquote_or_none(R#R�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>�stdefault_handler_classtdefault_handler_argsRei�(R+R�R,tRedirectHandlerR�R�RfR�R�tregexRXR�RAtgroupst
groupindext	groupdictR8R6R�R5RBRFtErrorHandler(R&tappR�R�RXts((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s6				
(		cC�s-|jr|jj|�S|jj|�dS(N(R�RR�R�R�(R&tdata((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s	cC�sR|jr|jjjd�n/dj|j�|j_|jj�|j�dS(NR�(	R�R,RPRR2R�R�t_parse_bodyR�(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s
	
cC�s&|jr|jj�n	d|_dS(N(R�RR?R2R�(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR?�s	cC�s|jjjdt�sOtj�)x!tjj�D]}|j�q2WWdQXn|jjjdt�stt	j�n|j
|j|j|j�|_
g|jjD]}||j�^q�}|jr�t�|j
_n|j
j||j|j�}|j
jS(NR�R�(R+RBRFR0RR�R�R�tresetRdR�R,R�RR|R�RR4R�R5R6(R&RRR|R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s

(	(
R�R�R*R�R�R�R�R�R?R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�vs	
			%			RCcB�s#eZdZdd�Zd�ZRS(sAn exception that will turn into an HTTP error response.

    Raising an `HTTPError` is a convenient alternative to calling
    `RequestHandler.send_error` since it automatically ends the
    current function.

    To customize the response sent with an `HTTPError`, override
    `RequestHandler.write_error`.

    :arg int status_code: HTTP status code.  Must be listed in
        `httplib.responses <http.client.responses>` unless the ``reason``
        keyword argument is given.
    :arg string log_message: Message to be written to the log for this error
        (will not be shown to the user unless the `Application` is in debug
        mode).  May contain ``%s``-style placeholders, which will be filled
        in with remaining positional parameters.
    :arg string reason: Keyword-only argument.  The HTTP "reason" phrase
        to pass in the status line along with ``status_code``.  Normally
        determined automatically from ``status_code``, but can be used
        to use a non-standard numeric code.
    cO�sY||_||_||_|jdd�|_|rU|rU|jdd�|_ndS(NRft%s%%(ReR�RDRFR2Rftreplace(R&ReR�RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*�s			
cC�sYd|j|jp'tjj|jd�f}|jrQ|d|j|jdS|SdS(NsHTTP %d: %stUnknowns (t)(ReRfR	R`RFR�RD(R&R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt__str__s%	N(R�R�R�R2R*R(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRC�sR�cB�seZdZRS(s�An exception that ends the request without producing an error response.

    When `Finish` is raised in a `RequestHandler`, the request will end
    (calling `RequestHandler.finish` if it hasn't already been called),
    but the outgoing response will not be modified and the error-handling
    methods (including `RequestHandler.write_error`) will not be called.

    This can be a more convenient way to implement custom error pages
    than overriding ``write_error`` (especially in library code)::

        if self.current_user is None:
            self.set_status(401)
            self.set_header('WWW-Authenticate', 'Basic realm="something"')
            raise Finish()
    (R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�sR�cB�seZdZd�ZRS(s�Exception raised by `RequestHandler.get_argument`.

    This is a subclass of `HTTPError`, so if it is uncaught a 400 response
    code will be used instead of 500 (and a stack trace will not be logged).

    .. versionadded:: 3.1
    cC�s*tt|�jdd|�||_dS(Ni�sMissing argument %s(R)R�R*targ_name(R&R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR**s(R�R�R�R*(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�"sR�cB�s)eZdZd�Zd�Zd�ZRS(sBGenerates an error response with ``status_code`` for all requests.cC�s|j|�dS(N(Rg(R&Re((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR@2scC�st|j��dS(N(RCR_(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRL5scC�sdS(N((R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR`8s(R�R�R�R@RLR`(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�0s		R�cB�s#eZdZed�Zd�ZRS(sRedirects the client to the given URL for all GET requests.

    You should provide the keyword argument ``url`` to the handler, e.g.::

        application = web.Application([
            (r"/oldpath", web.RedirectHandler, {"url": "/newpath"}),
        ])
    cC�s||_||_dS(N(t_urlt
_permanent(R&R�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR@Hs	cC�s|j|jd|j�dS(NR�(R�RR(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRFLs(R�R�R�R0R@RF(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�?sRdcB�s%eZdZdZiZej�Zdd�Z	e
d��Zd�Ze
jed��Zd�Zd	�Zd
�Ze
d��Zd�Ze
ddd
��Ze
d��Zd�Zd�Zd�Zd�Zd�Zd�Ze
ed��Zd�Ze
d��Z e
d��Z!RS(s�A simple handler that can serve static content from a directory.

    A `StaticFileHandler` is configured automatically if you pass the
    ``static_path`` keyword argument to `Application`.  This handler
    can be customized with the ``static_url_prefix``, ``static_handler_class``,
    and ``static_handler_args`` settings.

    To map an additional path to this handler for a static data directory
    you would add a line to your application like::

        application = web.Application([
            (r"/content/(.*)", web.StaticFileHandler, {"path": "/var/www"}),
        ])

    The handler constructor requires a ``path`` argument, which specifies the
    local root directory of the content to be served.

    Note that a capture group in the regex is required to parse the value for
    the ``path`` argument to the get() method (different than the constructor
    argument above); see `URLSpec` for details.

    To maximize the effectiveness of browser caching, this class supports
    versioned urls (by default using the argument ``?v=``).  If a version
    is given, we instruct the browser to cache this file indefinitely.
    `make_static_url` (also available as `RequestHandler.static_url`) can
    be used to construct a versioned url.

    This handler is intended primarily for use in development and light-duty
    file serving; for heavy traffic it will be more efficient to use
    a dedicated static file server (such as nginx or Apache).  We support
    the HTTP ``Accept-Ranges`` mechanism to return partial content (because
    some browsers require this functionality to be present to seek in
    HTML5 audio or video), but this handler should not be used with
    files that are too large to fit comfortably in memory.

    **Subclassing notes**

    This class is designed to be extensible by subclassing, but because
    of the way static urls are generated with class methods rather than
    instance methods, the inheritance patterns are somewhat unusual.
    Be sure to use the ``@classmethod`` decorator when overriding a
    class method.  Instance methods may use the attributes ``self.path``
    ``self.absolute_path``, and ``self.modified``.

    Subclasses should only override methods discussed in this section;
    overriding other methods is error-prone.  Overriding
    ``StaticFileHandler.get`` is particularly problematic due to the
    tight coupling with ``compute_etag`` and other methods.

    To change the way static urls are generated (e.g. to match the behavior
    of another server or CDN), override `make_static_url`, `parse_url_path`,
    `get_cache_time`, and/or `get_version`.

    To replace all interaction with the filesystem (e.g. to serve
    static content from a database), override `get_content`,
    `get_content_size`, `get_modified_time`, `get_absolute_path`, and
    `validate_absolute_path`.

    .. versionchanged:: 3.1
       Many of the methods for subclasses were added in Tornado 3.1.
    i�Qimi
cC�s||_||_dS(N(troottdefault_filename(R&R�R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR@�s	cC�s|j�i|_WdQXdS(N(t_lockt_static_hashes(R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s
cC�s|j|dt�S(Ntinclude_body(RFR-(R&R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRE�sc
c�s�|j|�|_~|j|j|j�}|j|j|�|_|jdkrXdS|j�|_|j	�|j
�r�|jd�dSd}|jj
jd�}|r�tj|�}n|j�}|r�|\}}|dk	r�||ks|dkr;|jd�|jdd�|jdd|f�dS|dk	r`|dkr`||7}n|dk	r�||kr�|}n||p�||p�dkr�|jd	�|jdtj|||��q�n
d}}|dk	r�|dk	r�||}	n4|dk	r|}	n|dk	r,||}	n|}	|jd
|	�|r�|j|j||�}
t|
t�r{|
g}
nx]|
D]:}y|j|�|j�VWq�tjk
r�dSXq�Wn|jjdks�t�dS(Ni0tRangeii�sContent-Types
text/plains
Content-Ranges
bytes */%si�sContent-LengthR(tparse_url_pathR�tget_absolute_pathRtvalidate_absolute_patht
absolute_pathR2tget_modified_timetmodifiedtset_headerstshould_return_304RgR,R8RFR	t_parse_request_rangetget_content_sizeRlt_get_content_rangetget_contentRpRqR�RR
RSRR�(R&R�R
Rt
request_rangetrange_headertsizeR�tendR$tcontentR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRF�sh

$

	
	

	


cC�s'|j|j�}|sdSd|fS(sSets the ``Etag`` header based on static url version.

        This allows efficient ``If-None-Match`` checks against cached
        versions, and sends the correct ``Etag`` for a partial response
        (i.e. the same ``Etag`` as the full file).

        .. versionadded:: 3.1
        s"%s"N(t_get_cached_versionRR2(R&tversion_hash((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRo�s	cC�s�|jdd�|j�|jd
k	r?|jd|j�n|j�}|rd|jd|�n|j|j|j|�}|dkr�|jdtjj�tj	d|��|jdd	t
|��n|j|j�d
S(s]Sets the content and caching headers on the response.

        .. versionadded:: 3.1
        s
Accept-RangesRqs
Last-ModifiedsContent-TypeitExpirestsecondss
Cache-Controlsmax-age=N(RlRRR2tget_content_typetget_cache_timeR�RvR�R�Rutset_extra_headers(R&tcontent_typet
cache_time((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s
	cC�s|j�rtS|jjjd�}|dk	r{tjj|�}|dk	r{t	j	|d �}||j
krxtSq{ntS(sgReturns True if the headers indicate that we should return 304.

        .. versionadded:: 3.1
        sIf-Modified-SinceiN(R R0R,R8RFR2temailtutilst	parsedateRvRR-(R&t	ims_valuet
date_tupletif_since((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR	s
cC�s%tjjtjj||��}|S(s�Returns the absolute location of ``path`` relative to ``root``.

        ``root`` is the path configured for this `StaticFileHandler`
        (in most cases the ``static_path`` `Application` setting).

        This class method may be overridden in subclasses.  By default
        it returns a filesystem path, but other strings may be used
        as long as they are unique and understood by the subclass's
        overridden `get_content`.

        .. versionadded:: 3.1
        (R�R�tabspathR�(R�RR�R,((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR
%	s!cC�stjj|�tjj}|tjjj|�sMtdd|j��ntjj|�r�|jdk	r�|j	jj
d�s�|j|j	jddt�dStjj
||j�}ntjj|�s�td��ntjj|�s
tdd|j��n|S(s�Validate and return the absolute path.

        ``root`` is the configured path for the `StaticFileHandler`,
        and ``path`` is the result of `get_absolute_path`

        This is an instance method called during request processing,
        so it may raise `HTTPError` or use methods like
        `RequestHandler.redirect` (return None after redirecting to
        halt further processing).  This is where 404 errors for missing files
        are generated.

        This method may modify the path before returning it, but note that
        any such modifications will not be understood by `make_static_url`.

        In instance methods, this method's result is available as
        ``self.absolute_path``.

        .. versionadded:: 3.1
        i�s"%s is not in root static directoryR�R�Ni�s%s is not a file(R�R�R,tsepR�RCtisdirRR2R,R�R�R0R�texiststisfile(R&RR((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR6	s	c	c�s�t|d���}|dk	r.|j|�n|dk	rM||pFd}nd}x�tr�d}|dk	r�||kr�|}n|j|�}|r�|dk	r�|t|�8}n|VqV|dk	r�|dks�t�ndSqVWWdQXdS(sZRetrieve the content of the requested resource which is located
        at the given absolute path.

        This class method may be overridden by subclasses.  Note that its
        signature is different from other overridable class methods
        (no ``settings`` argument); this is deliberate to ensure that
        ``abspath`` is able to stand on its own as a cache key.

        This method should either return a byte string or an iterator
        of byte strings.  The latter is preferred for large files
        as it helps reduce memory fragmentation.

        .. versionadded:: 3.1
        trbii@iNi(topenR2tseekR0treadRxR�(R�R,R�Rtfilet	remainingt
chunk_sizeR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRc	s$		cC�sb|j|�}tj�}t|t�r:|j|�nx|D]}|j|�qAW|j�S(s�Returns a version string for the resource at the given path.

        This class method may be overridden by subclasses.  The
        default implementation is a hash of the file's contents.

        .. versionadded:: 3.1
        (RRktmd5RpRqR�Rm(R�R,R�RnR�((s1/usr/lib64/python2.7/site-packages/tornado/web.pytget_content_version�	s	
cC�s.t|d�s'tj|j�|_n|jS(Nt_stat_result(R�R�tstatRR:(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_stat�	scC�s|j�}|tjS(s%Retrieve the total size of the resource at the given path.

        This method may be overridden by subclasses.

        .. versionadded:: 3.1

        .. versionchanged:: 4.0
           This method is now always called, instead of only when
           partial results are requested.
        (R<R;tST_SIZE(R&tstat_result((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�	scC�s)|j�}tjj|tj�}|S(s�Returns the time that ``self.absolute_path`` was last modified.

        May be overridden in subclasses.  Should return a `~datetime.datetime`
        object or None.

        .. versionadded:: 3.1
        (R<RvtutcfromtimestampR;tST_MTIME(R&R>R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�	s	cC�stj|j�\}}|S(shReturns the ``Content-Type`` header to be used for this request.

        .. versionadded:: 3.1
        (t	mimetypest
guess_typeR(R&t	mime_typetencoding((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR!�	scC�sdS(s1For subclass to add extra headers to the responseN((R&R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR#�	scC�sd|jjkr|jSdS(s�Override to customize cache control behavior.

        Return a positive number of seconds to make the result
        cacheable for that amount of time or 0 to mark resource as
        cacheable for an unspecified amount of time (subject to
        browser heuristics).

        By default returns cache expiry of 10 years for resources requested
        with ``v`` argument.
        R�i(R,R|t
CACHE_MAX_AGE(R&R�RRC((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR"�	scC�sJ|jdd�|}|s |S|j||�}|s<|Sd||fS(sConstructs a versioned url for the given path.

        This method may be overridden in subclasses (but note that it
        is a class method rather than an instance method).  Subclasses
        are only required to implement the signature
        ``make_static_url(cls, settings, path)``; other keyword
        arguments may be passed through `~RequestHandler.static_url`
        but are not standard.

        ``settings`` is the `Application.settings` dictionary.  ``path``
        is the static path being requested.  The url returned should be
        relative to the current host.

        ``include_version`` determines whether the generated URL should
        include the query string containing the version hash of the
        file corresponding to the given ``path``.

        R�s/static/s%s?v=%s(RFtget_version(R�RBR�tinclude_versionR�R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRe�	scC�s1tjjdkr-|jdtjj�}n|S(s"Converts a static URL path into a filesystem path.

        ``url_path`` is the path component of the URL with
        ``static_url_prefix`` removed.  The return value should be
        filesystem path relative to ``static_path``.

        This is the inverse of `make_static_url`.
        R�(R�R�R-R�(R&turl_path((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�	s	cC�s#|j|d|�}|j|�S(s%Generate the version string to be used in static URLs.

        ``settings`` is the `Application.settings` dictionary and ``path``
        is the relative location of the requested asset on the filesystem.
        The returned value should be a string, or ``None`` if no version
        could be determined.

        .. versionchanged:: 3.1
           This method was previously recommended for subclasses to override;
           `get_content_version` is now preferred as it allows the base
           class to handle caching of the result.
        Ra(R
R(R�RBR�tabs_path((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRF�	sc	C�s�|j�{|j}||krgy|j|�||<Wqgtk
rctjd|�d||<qgXn|j|�}|r�|SWdQXdS(NsCould not open static file %r(RR	R9R�RR&R2RF(R�RIthashesthsh((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR
s
	

i�3�i�N("R�R�R�RER	R�R�RR2R@tclassmethodR�RERR�R0RFRoRRR
RRR9R<RRR!R#R"ReRRFR(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRdPs8=	K				-$			
			
	
tFallbackHandlercB�s eZdZd�Zd�ZRS(sMA `RequestHandler` that wraps another HTTP server callback.

    The fallback is a callable object that accepts an
    `~.httputil.HTTPServerRequest`, such as an `Application` or
    `tornado.wsgi.WSGIContainer`.  This is most useful to use both
    Tornado ``RequestHandlers`` and WSGI in the same server.  Typical
    usage::

        wsgi_app = tornado.wsgi.WSGIContainer(
            django.core.handlers.wsgi.WSGIHandler())
        application = tornado.web.Application([
            (r"/foo", FooHandler),
            (r".*", FallbackHandler, dict(fallback=wsgi_app),
        ])
    cC�s
||_dS(N(tfallback(R&RN((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR@/
scC�s|j|j�t|_dS(N(RNR,R0R/(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRL2
s(R�R�R�R@RL(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRM
s	tOutputTransformcB�s)eZdZd�Zd�Zd�ZRS(s�A transform modifies the result of an HTTP request (e.g., GZip encoding)

    Applications are not expected to create their own OutputTransforms
    or interact with them directly; the framework chooses which transforms
    (if any) to apply.
    cC�sdS(N((R&R,((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*>
scC�s
|||fS(N((R&ReR8R�t	finishing((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRA
scC�s|S(N((R&R�RP((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRD
s(R�R�R�R*RR(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRO7
s		R�cB�sVeZdZeddddddg�ZdZd�Zd	�Zd
�Zd�Z	RS(sIApplies the gzip content encoding to the response.

    See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11

    .. versionchanged:: 4.0
        Now compresses all mime types beginning with ``text/``, instead
        of just a whitelist. (the whitelist is still used for certain
        non-text mime types).
    sapplication/javascriptsapplication/x-javascriptsapplication/xmlsapplication/atom+xmlsapplication/jsonsapplication/xhtml+xmlicC�s"d|jjdd�k|_dS(NR�sAccept-EncodingR�(R8RFt	_gzipping(R&R,((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*Y
scC�s|jd�p||jkS(Nstext/(R�t
CONTENT_TYPES(R&tctype((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_compressible_type\
scC�s(d|kr|dcd7<n
d|d<|jr�t|jdd��jd�d}|j|�o�|s�t|�|jko�d|k|_n|jrd	|d<t�|_t	j
d
dd|j�|_|j||�}d
|kr|rt
t|��|d
<q|d
=qn|||fS(NtVarys, Accept-EncodingsAccept-EncodingsContent-TypeR�R3isContent-EncodingR�tmodetwtfileobjsContent-Length(RQRRFR9RTRxt
MIN_LENGTHRt_gzip_valueR�tGzipFilet
_gzip_fileRRu(R&ReR8R�RPRS((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR_
s$
	%	

cC�sr|jrn|jj|�|r/|jj�n
|jj�|jj�}|jjd�|jjd�n|S(Ni(	RQR\R�tcloseRRZtgetvaluettruncateR3(R&R�RP((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRy
s	
(
R�R�R�R�RRRYR*RTRR(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�H
s					c�s"tj���fd��}|S(s�Decorate methods with this to require that the user be logged in.

    If the user is not logged in, they will be redirected to the configured
    `login url <RequestHandler.get_login_url>`.

    If you configure a login url with a query parameter, Tornado will
    assume you know what you're doing and use it as-is.  If not, it
    will add a `next` parameter so the login page knows where to send
    you once you're logged in.
    c�s�|js�|jjdkr�|j�}d|kr�tj|�jrW|jj�}n|jj}|dt	t
d|��7}n|j|�dStd��n�|||�S(NRRR�tnexti�(sGETsHEAD(
RR,RRFturlparseturlsplittschemetfull_urlR�RR�R�RC(R&RDRAR�tnext_url(R(s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s	 
(R�R�(RR�((Rs1/usr/lib64/python2.7/site-packages/tornado/web.pyt
authenticated�
sR�cB�sneZdZd�Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
RS(s2A re-usable, modular UI unit on a page.

    UI modules often execute additional queries, and they can include
    additional CSS and JavaScript that will be included in the output
    page, which is automatically inserted on page render.

    Subclasses of UIModule must override the `render` method.
    cC�s1||_|j|_|j|_|j|_dS(N(RR,R9R(R&R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*�
s	cC�s
|jjS(N(RR(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�
scO�s
t��dS(s6Override in subclasses to return this module's output.N(R�(R&RDRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(sJOverride to return a JavaScript string
        to be embedded in the page.N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(s�Override to return a list of JavaScript files needed by this module.

        If the return values are relative paths, they will be passed to
        `RequestHandler.static_url`; otherwise they will be used as-is.
        N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(sJOverride to return a CSS string
        that will be embedded in the page.N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(s�Override to returns a list of CSS files required by this module.

        If the return values are relative paths, they will be passed to
        `RequestHandler.static_url`; otherwise they will be used as-is.
        N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(s[Override to return an HTML string that will be put in the <head/>
        element.
        N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scC�sdS(sfOverride to return an HTML string that will be put at the end of
        the <body/> element.
        N(R2(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
scK�s|jj||�S(s.Renders a template and returns it as a string.(RR�(R&R�RA((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s(R�R�R�R*R�RR�R�R�R�R�R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s								R�cB�seZd�ZRS(cK�stj||�S(N(RR�(R&ttextRA((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s(R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
sR�cB�seZd�ZRS(cC�s
|jj�S(N(RR	(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s(R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
sR�cB�s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s�UIModule that simply renders the given template.

    {% module Template("foo.html") %} is similar to {% include "foo.html" %},
    but the module version gets its own namespace (with kwargs passed to
    Template()) instead of inheriting the outer template's namespace.

    Templates rendered through this module also get access to UIModule's
    automatic javascript/css features.  Simply call set_resources
    inside the template and give it keyword arguments corresponding to
    the methods on UIModule: {{ set_resources(js_files=static_url("my.js")) }}
    Note that these resources are output once per template file, not once
    per instantiation of the template, so they must not depend on
    any arguments to the template.
    cC�s,tt|�j|�g|_i|_dS(N(R)R�R*t_resource_listt_resource_dict(R&R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*�
s	c�s(��fd�}�j�d||�S(Nc�sU��jkr/�jj|�|�j�<n"�j�|krQtd��ndS(NsCset_resources called with different resources for the same templateR�(RiRhR�Rd(RA(R�R&(s1/usr/lib64/python2.7/site-packages/tornado/web.pyt
set_resourcessRj(R�(R&R�RARj((R�R&s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s	c�s�fd�|jD�S(Nc3�s%|]}�|kr|�VqdS(N((R#tr(R4(s1/usr/lib64/python2.7/site-packages/tornado/web.pys	<genexpr>s(Rh(R&R4((R4s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_get_resourcesscC�sdj|jd��S(Ns
R�(R�Rl(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�scC�sVg}xI|jd�D]8}t|ttf�rA|j|�q|j|�qW|S(NR�(RlRpRRqR�R�(R&R~R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�scC�sdj|jd��S(Ns
R�(R�Rl(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�!scC�sVg}xI|jd�D]8}t|ttf�rA|j|�q|j|�qW|S(NR�(RlRpRRqR�R�(R&R~R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�$scC�sdj|jd��S(NR�R�(R�Rl(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�-scC�sdj|jd��S(NR�R�(R�Rl(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�0s(R�R�R�R*R�RlR�R�R�R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��
s		
								R:cB�s)eZdZd�Zd�Zd�ZRS(sALazy namespace which creates UIModule proxies bound to a handler.cC�s||_||_dS(N(RR;(R&RR;((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*6s	cC�s|jj||j|�S(N(RR�R;(R&R4((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt__getitem__:scC�s8y||SWn%tk
r3}tt|���nXdS(N(RctAttributeErrorRu(R&R4R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt__getattr__=s(R�R�R�R*RmRo(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR:4s		R�cB�s8eZdZddd�Zd�Zd�Zd�ZRS(s-Specifies mappings between URLs and handlers.cC�s�|jd�s|d7}ntj|�|_t|jj�d|jjfkshtd|jj��t	|t
�r�t|�}n||_|p�i|_
||_|j�\|_|_dS(s�Parameters:

        * ``pattern``: Regular expression to be matched.  Any groups
          in the regex will be passed in to the handler's get/post/etc
          methods as arguments.

        * ``handler``: `RequestHandler` subclass to be invoked.

        * ``kwargs`` (optional): A dictionary of additional arguments
          to be passed to the handler's constructor.

        * ``name`` (optional): A name for this handler.  Used by
          `Application.reverse_url`.
        R�isDgroups in url regexes must either be all named or all positional: %rN(R�R�R�R�RxR�R�R�R�RpRuRR�RARjt_find_groupst_patht_group_count(R&R�RRARj((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR*Fs
'		cC�s,d|jj|jj|j|j|jfS(Ns%s(%r, %s, kwargs=%r, name=%r)(ROR�R�R�R�RARj(R&((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt__repr__fscC�s�|jj}|jd�r(|d}n|jd�rD|d }n|jj|jd�krcdSg}xj|jd�D]Y}d|kr�|jd�}|dkr�|j	d||d�q�qy|j	|�qyWd	j
|�|jjfS(s�Returns a tuple (reverse string, group count) for a url.

        For example: Given the url pattern /([0-9]{4})/([a-z-]+)/, this method
        would return ('/%s/%s/', 2).
        t^iR�i����t(Ris%sR�N(NN(R�R�R�R�R�tcountR2R9R�R�R�(R&R�tpiecestfragmentt	paren_loc((s1/usr/lib64/python2.7/site-packages/tornado/web.pyRpks

cG�s�|jdk	s%td|jj��t|�|jksFtd��t|�sY|jSg}xT|D]L}t|tt	f�s�t
|�}n|jtj
t|�dt��qfW|jt|�S(NsCannot reverse url regex s&required number of arguments not foundtplus(RqR2R�R�R�RxRrRpRRqRuR�Rt
url_escapeRR-R�(R&RDtconverted_argsta((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR7�s!
&N(R�R�R�R2R*RsRpR7(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�Ds
 		tcompare_digestcC�s�t|�t|�krtSd}t|dt�rfxht||�D]\}}|||AO}qEWn:x7t||�D]&\}}|t|�t|�AO}qvW|dkS(Ni(RxR-RpR�tziptord(R}tbR~R�ty((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR^�sc
C�sk|dkrt}n|dkr-tj}nttt|����}tjt|��}|dkr�t||||�}dj	|||g�}|S|dkrWd�}dj	d|t|p�d��||�||�||�dg�}	t
|t�r@|dk	std��|dks3td	��||}nt
||	�}|	|Std
|��dS(NiRIicS�stdt|��t|�S(Ns%d:(RRx(R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pytformat_field�sRJiR�s2Key version must be set when sign key dict is useds2Version must be at least 2 for key version supportsUnsupported version %d(R2tDEFAULT_SIGNED_VALUE_VERSIONR[RRuR�tbase64t	b64encodet_create_signature_v1R�RpR�R�t_create_signature_v2Rd(
R�RjRkRYtclockR�RQt	signatureR�tto_sign((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s4					
s^([1-9][0-9]*)\|(.*)$cC�sptj|�}|dkr$d}nHy.t|jd��}|dkrQd}nWntk
rkd}nX|S(Nii�(RWRXR2R�RYRd(RkR%RY((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_get_version�s	


icC�s�|dkrtj}n|dkr-t}n|dkrLtd|��n|sVdSt|�}t|�}||kr~dS|dkr�t|||||�S|dkr�t|||||�SdSdS(NisUnsupported min_version %di(R2R[t DEFAULT_SIGNED_VALUE_MIN_VERSIONRdRR�t_decode_signed_value_v1t_decode_signed_value_v2(R�RjRkR�R�R�RY((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR��s&	

cC�s&t|�jd�}t|�dkr+dSt|||d|d�}t|d|�sotjd|�dSt|d�}||�|dkr�tjd|�dS||�d
kr�tjd
|�dS|dj	d�r�tjd|�dSyt
j|d�SWntk
r!dSXdS(NRIiiiisInvalid cookie signature %ri�QsExpired cookie %ris1Cookie timestamp in future; possible tampering %rt0sTampered cookie %ri��((
RR9RxR2R�R^RR�R�R�R�t	b64decodeR�(R�RjRkR�R�R?R�RQ((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�s,	
cC�std�}|d}||�\}}||�\}}||�\}}||�\}}t|�||||fS(NcS�sl|jd�\}}}t|�}|| }|||d!dkrTtd��n||d}||fS(Nt:iRIsmalformed v2 signed value field(t	partitionR�Rd(R�tlengthRtrestR$tfield_value((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_consume_field-s
i(R�(RkR�R�R�RQt
name_fieldtvalue_fieldt
passed_sig((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt_decode_fields_v2,s	
cC�syt|�\}}}}}	Wntk
r3dSX|t|	� }
t|t�rzy||}Wqztk
rvdSXnt||
�}t|	|�s�dS|t	|�kr�dSt
|�}||�|dkr�dSytj|�SWnt
k
r�dSXdS(Ni�Q(R�RdR2RxRpR�RcR�R^RR�R�R�R�(R�RjRkR�R�R�RQR�R�R�t
signed_stringtexpected_sig((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�@s,


cC�s`t|�}t|�}|dkr(dSyt|�\}}}}}Wntk
r[dSX|S(Ni(RR�R2R�Rd(RkRYR�R((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�\s
cG�sRtjt|�dtj�}x!|D]}|jt|��q%Wt|j��S(Nt	digestmod(thmactnewRRkRlR�Rm(R�R?thashR((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�is
cC�sAtjt|�dtj�}|jt|��t|j��S(NR�(R�R�RRktsha256R�Rm(R�R�R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�pscC�s)|dkr|Stj|dddt�S(s�None-safe wrapper around url_unescape to handle unamteched optional
    groups correctly.

    Note that args are passed as bytes so the handler can decide what
    encoding to use.
    RDRzN(R2Rturl_unescapeR-(R�((s1/usr/lib64/python2.7/site-packages/tornado/web.pyR�vs(pR�t
__future__RRRRR�RMRvtemail.utilsR&R�R�RkR�RARstos.pathR�R�R;R�R�R[RXR+R�tioRttornado.concurrentRRRRR	R
Rttornado.logRR
RRRttornado.escapeRRttornado.utilRRRRRttornado.httputilRR�tImportErrorthttp.cookiesR�Raturllib.parsetparseturllibRt"MIN_SUPPORTED_SIGNED_VALUE_VERSIONt"MAX_SUPPORTED_SIGNED_VALUE_VERSIONR�R�tobjectRR�R�RNR�R�tHTTPServerConnectionDelegateR�tHTTPMessageDelegateR�R�RCR�R�R�R�RdRMROR�RfR�R�R�R�R:R�R�R�R~R^R2R�R�RWR�R�R�R�R�R�R�R�R�(((s1/usr/lib64/python2.7/site-packages/tornado/web.pyt<module>8s�"(


	�����d	H				�q(��>	BDQ	
1					
		

Zerion Mini Shell 1.0