403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/paste/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/paste/recursive.pyc
Ñò
•ÊIc@sdZddklZddkZdgZddgZdefd„ƒYZdefd„ƒYZde	fd	„ƒYZ
d
efd„ƒYZdefd
„ƒYZdefd„ƒYZ
defd„ƒYZdefd„ƒYZdefd„ƒYZd„Zee_dS(s
Middleware to make internal requests and forward requests internally.

When applied, several keys are added to the environment that will allow
you to trigger recursive redirects and forwards.

  paste.recursive.include:
      When you call
      ``environ['paste.recursive.include'](new_path_info)`` a response
      will be returned.  The response has a ``body`` attribute, a
      ``status`` attribute, and a ``headers`` attribute.

  paste.recursive.script_name:
      The ``SCRIPT_NAME`` at the point that recursive lives.  Only
      paths underneath this path can be redirected to.

  paste.recursive.old_path_info:
      A list of previous ``PATH_INFO`` values from previous redirects.

Raise ``ForwardRequestException(new_path_info)`` to do a forward
(aborting the current request).
iÿÿÿÿ(tStringIONtRecursiveMiddlewaretForwardRequestExceptiontCheckForRecursionMiddlewarecBseZd„Zd„ZRS(cCs||_||_dS(N(tapptenv(tselfRR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt__init__!s	cCs|iddƒ}||iidgƒjo!td||idfƒ‚n|iidgƒ}|i|iiddƒƒ|i||ƒS(Nt	PATH_INFOtspaste.recursive.old_path_infosGForwarding loop detected; %r visited twice (internal redirect path: %s)(tgetRtAssertionErrort
setdefaulttappendR(Rtenvirontstart_responset	path_infot
old_path_info((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt__call__%s(t__name__t
__module__RR(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR s	cBs#eZdZdd„Zd„ZRS(s}
    A WSGI middleware that allows for recursive and forwarded calls.
    All these calls go to the same 'application', but presumably that
    application acts differently with different URLs.  The forwarded
    URLs must be relative to this container.

    Interface is entirely through the ``paste.recursive.forward`` and
    ``paste.recursive.include`` environmental keys.
    cCs
||_dS(N(tapplication(RRtglobal_conf((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR=scCs¹t|i||ƒ|d<t|i||ƒ|d<t|i||ƒ|d<|iddƒ}||d<y|i||ƒSWn7tj
o+}t|i|ƒ|ƒ}|||ƒSXdS(Nspaste.recursive.forwardspaste.recursive.includes paste.recursive.include_app_itertSCRIPT_NAMER	spaste.recursive.script_name(t	ForwarderRtIncludertIncluderAppIterR
RRtfactory(RRRtmy_script_nametet
middleware((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR@s(



N(RRt__doc__tNoneRR(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR1s
cBs#eZdZdhddd„ZRS(sl

    Used to signal that a request should be forwarded to a different location.
    
    ``url``
        The URL to forward to starting with a ``/`` and relative to 
        ``RecursiveMiddleware``. URL fragments can also contain query strings 
        so ``/error?code=404`` would be a valid URL fragment.
    
    ``environ``
        An altertative WSGI environment dictionary to use for the forwarded 
        request. If specified is used *instead* of the ``url_fragment``
     
    ``factory``
        If specifed ``factory`` is used instead of ``url`` or ``environ``. 
        ``factory`` is a callable that takes a WSGI application object 
        as the first argument and returns an initialised WSGI middleware
        which can alter the forwarded response.

    Basic usage (must have ``RecursiveMiddleware`` present) :
    
    .. code-block:: python
    
        from paste.recursive import ForwardRequestException
        def app(environ, start_response):
            if environ['PATH_INFO'] == '/hello':
                start_response("200 OK", [('Content-type', 'text/plain')])
                return ['Hello World!']
            elif environ['PATH_INFO'] == '/error':
                start_response("404 Not Found", [('Content-type', 'text/plain')])
                return ['Page not found']
            else:
                raise ForwardRequestException('/error')
                
        from paste.recursive import RecursiveMiddleware
        app = RecursiveMiddleware(app)
        
    If you ran this application and visited ``/hello`` you would get a 
    ``Hello World!`` message. If you ran the application and visited 
    ``/not_found`` a ``ForwardRequestException`` would be raised and the caught
    by the ``RecursiveMiddleware``. The ``RecursiveMiddleware`` would then 
    return the headers and response from the ``/error`` URL but would display 
    a ``404 Not found`` status message.
    
    You could also specify an ``environ`` dictionary instead of a url. Using 
    the same example as before:
    
    .. code-block:: python
    
        def app(environ, start_response):
            ... same as previous example ...
            else:
                new_environ = environ.copy()
                new_environ['PATH_INFO'] = '/error'
                raise ForwardRequestException(environ=new_environ)
                
    Finally, if you want complete control over every aspect of the forward you
    can specify a middleware factory. For example to keep the old status code 
    but use the headers and resposne body from the forwarded response you might
    do this:
    
    .. code-block:: python

        from paste.recursive import ForwardRequestException
        from paste.recursive import RecursiveMiddleware
        from paste.errordocument import StatusKeeper

        def app(environ, start_response):
            if environ['PATH_INFO'] == '/hello':
                start_response("200 OK", [('Content-type', 'text/plain')])
                return ['Hello World!']
            elif environ['PATH_INFO'] == '/error':
                start_response("404 Not Found", [('Content-type', 'text/plain')])
                return ['Page not found']
            else:
                def factory(app):
                    return StatusKeeper(app, status='404 Not Found', url='/error')
                raise ForwardRequestException(factory=factory)

        app = RecursiveMiddleware(app)
    csf|oˆotdƒ‚n|oˆotdƒ‚nˆoˆotdƒ‚n|o7ˆptidtdƒn
tdƒ‚||_nˆo dtˆƒjo
ˆ|_ndtfd	„ƒY‰t|d
ƒo(|i‰‡‡fd†}||_nVˆo‡‡fd†}||_n0ˆo‡‡fd
†}||_n
||_dS(Ns?You cannot specify factory and a url in ForwardRequestExceptionsAYou cannot specify factory and environ in ForwardRequestExceptions=You cannot specify environ and url in ForwardRequestExceptionsgForwardRequestException(path_info=...) has been deprecated; please use ForwardRequestException(url=...)is;You cannot use url and path_info in ForwardRequestExceptiont?t!ForwardRequestExceptionMiddlewarecBseZd„ZRS(cSs
||_dS(N(R(RR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRÍs(RRR(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR"ÌsRcs&dˆf‡fd†ƒY}||ƒS(NtPathInfoForwardcseZ‡fd†ZRS(csˆ|d<|i||ƒS(NR(R(RRR(tp(s3/usr/lib/python2.6/site-packages/paste/recursive.pyRÕs
(RRR((R$(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR#Ôs((RR#(R"R$(s3/usr/lib/python2.6/site-packages/paste/recursive.pytfactory_Óscs&dˆf‡fd†ƒY}||ƒS(Nt
URLForwardcseZ‡fd†ZRS(cs>ˆidƒd|d<ˆidƒd|d<|i||ƒS(NR!iRitQUERY_STRING(tsplitR(RRR(turl(s3/usr/lib/python2.6/site-packages/paste/recursive.pyRÝs(RRR((R)(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR&Üs((RR&(R"R)(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR%Ûscs&dˆf‡fd†ƒY}||ƒS(NtEnvironForwardcseZ‡fd†ZRS(cs|iˆ|ƒS(N(R(Rtenviron_R(R(s3/usr/lib/python2.6/site-packages/paste/recursive.pyRæs(RRR((R(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR*ås((RR*(R"R(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR%äs(	t	TypeErrortwarningstwarntDeprecationWarningRtstrtobjectthasattrR(RR)RRRR%((R"R)R$Rs3/usr/lib/python2.6/site-packages/paste/recursive.pyR¨s<




	


N(RRRR R(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRVs
Pt	RecursivecBs/eZd„Zdd„Zd„Zd„ZRS(cCs.||_|iƒ|_||_||_dS(N(Rtcopytoriginal_environtprevious_environR(RRRR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRïs		cCsù|iiƒ}|o|i|ƒn|i|d<|iidƒ}|idƒo<|i|ƒptd||f‚|t|ƒd}n|idƒpt‚d|}||d<d|d<d	|d
<d|d<tdƒ|d
<|i	|ƒS(sÓ
        `extra_environ` is an optional dictionary that is also added
        to the forwarded request.  E.g., ``{'HTTP_HOST': 'new.host'}``
        could be used to forward to a different virtual host.
        s paste.recursive.previous_environRt/sEYou can only forward requests to resources under the path %r (not %r)iRtGETtREQUEST_METHODt0tCONTENT_LENGTHR	tCONTENT_TYPEs
wsgi.input(
R5R4tupdateR6R
t
startswithRtlenRtactivate(Rtpatht
extra_environRt	base_pathR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRõs$





cCs
t‚dS(N(tNotImplementedError(RR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR@scCs0d|ii|ii|iidƒpdfS(Ns<%s.%s from %s>RR7(t	__class__RRR5R
(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt__repr__s		N(RRRR RR@RF(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR3ís		RcBseZdZd„ZRS(s

    The forwarder will try to restart the request, except with
    the new `path` (replacing ``PATH_INFO`` in the request).

    It must not be called after and headers have been returned.
    It returns an iterator that must be returned back up the call
    stack, so it must be used like:
    
    .. code-block:: python

        return environ['paste.recursive.forward'](path)

    Meaningful transformations cannot be done, since headers are
    sent directly to the server and cannot be inspected or
    rewritten.
    cCs&tidtdƒ|i||iƒS(NsKrecursive.Forwarder has been deprecated; please use ForwardRequestExceptioni(R-R.R/RR(RR((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR@*s
(RRRR@(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRsRcBseZdZd„ZRS(s§
    Starts another request with the given path and adding or
    overwriting any values in the `extra_environ` dictionary.
    Returns an IncludeResponse object.
    c
stƒ‰d‡fd†}|i||ƒ}z"x|D]}ˆi|ƒq7WWdt|dƒo|iƒnXˆiƒˆS(Ncs<|o|d|d|d‚n|ˆ_|ˆ_ˆiS(Niii(tstatustheaderstwrite(RGRHtexc_info(tresponse(s3/usr/lib/python2.6/site-packages/paste/recursive.pyR<s
		tclose(tIncludedResponseR RRIR2RL(RRRtapp_iterts((RKs3/usr/lib/python2.6/site-packages/paste/recursive.pyR@:s	
(RRRR@(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR2sRMcBsAeZd„Zd„Zd„Zd„Zd„ZeeƒZRS(cCs+d|_d|_tƒ|_d|_dS(N(R RHRGRtoutputR0(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRNs		cCs,|iiƒ|_|iiƒd|_dS(N(RPtgetvalueR0RLR (R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRLTs
cCs.|idj	p
td‚|ii|ƒdS(NsIThis response has already been closed and no further data can be written.(RPR RRI(RRO((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRIYscCs|iS(N(tbody(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt__str___scCs)|idjo|iiƒS|iSdS(N(R0R RPRQ(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt	body__getbs(	RRRRLRIRSRTtpropertyRR(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRMLs					RcBseZdZd„ZRS(sk
    Like Includer, but just stores the app_iter response
    (be sure to call close on the response!)
    cs:tƒ‰d‡fd†}|i||ƒ}|ˆ_ˆS(Ncs<|o|d|d|d‚n|ˆ_|ˆ_ˆiS(Niii(RGRHRI(RGRHRJ(RK(s3/usr/lib/python2.6/site-packages/paste/recursive.pyRrs
		(tIncludedAppIterResponseR RRN(RRRRN((RKs3/usr/lib/python2.6/site-packages/paste/recursive.pyR@ps
		(RRRR@(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRjsRVcBs#eZd„Zd„Zd„ZRS(cCs1d|_d|_g|_d|_t|_dS(N(R RGRHtaccumulatedRNtFalset_closed(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyR~s
				cCs=|ip
td‚t|idƒo|iiƒndS(NsTried to close twiceRL(RYRR2RNRL(R((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRL…scCs|iidS(N(RWR
(RRO((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRI‹s(RRRRLRI(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyRV|s		cCs
t|ƒS(N(R(RR((s3/usr/lib/python2.6/site-packages/paste/recursive.pytmake_recursive_middlewareŽs(Rt	cStringIORR-t__all__t
__pudge_all__R1RRt	ExceptionRR3RRRMRRVRZ(((s3/usr/lib/python2.6/site-packages/paste/recursive.pyt<module>s	%—*	

Youez - 2016 - github.com/yon3zu
LinuXploit