Ic@sjdZddlmZddlmZddlmZ ddl m Z ddl mZdefdYZd efd YZd efd YZd efdYZdZdefdYZdefdYZdZdZi dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6dd"6Zd#Zd&d$Zd&d%Zd&S('sError classes for CherryPy.i(tescape(texc_info(tformat_exception(turljoin(thttptCherryPyExceptioncBseZRS((t__name__t __module__(((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyR st TimeoutErrorcBseZdZRS(s5Exception raised when Response.timed_out is detected.(RRt__doc__(((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyRstInternalRedirectcBseZdZdZRS(sException raised to switch to the handler for a different URL. Any request.params must be supplied in a query string. cCs}ddl}|j}d|_d|krH|jdd\}|_nt|j|}||_tj|||jdS(Nitt?i( tcherrypytrequestt query_stringtsplitt_urljoint path_infotpathRt__init__(tselfRR R((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyRs     (RRR R(((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyR st HTTPRedirectcBs,eZdZddZdZdZRS(sSException raised when the request should be redirected. The new URL must be passed as the first argument to the Exception, e.g., HTTPRedirect(newUrl). Multiple URLs are allowed. If a URL is absolute, it will be used as-is. If it is relative, it is assumed to be relative to the current cherrypy.request.path_info. cCsddl}|j}t|tr0|g}ng}x0|D](}t|j|}|j|q=W||_|dkr|j dkrd}qd}n3t |}|dks|dkrt dn||_ t j|||dS( Niii/i.i,is#status must be between 300 and 399.(ii(R Rt isinstancet basestringRturltappendturlstNonetprotocoltintt ValueErrortstatusRR(RRR R Rtabs_urlsR((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyR8s$          c Csrddl}|j}|j|_}|dkrd|jd <|jd |jd %s.s;This resource has permanently moved to %s.s9This resource resides temporarily at %s.s;This resource has moved temporarily to %s.s
sContent-Lengthi0tAllowsContent-EncodingsContent-LanguagesContent-Locations Content-MD5s Content-RangetExpiress Last-Modifiedi1sThe %s status code is unknown.(i,i-i.i/i3( R#sContent-EncodingsContent-LanguagesContent-LengthsContent-Locations Content-MD5s Content-Ranges Content-TypeR$s Last-Modified( R tresponseR theadersRtjointbodytpopRR(RR R%R tmsgtutkey((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyt set_responseZs8     2     cCs |dS(s5Use this exception as a request.handler (raise self).N((R((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyt__call__sN(RRR RRR-R.(((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyR/s " 9c Csddl}|j}|j}xKddddddd d d d d dg D]}|j|rI||=qIqIW|dkr|jdr|d=qndS(s?Remove any headers which should not apply to an error response.iNs Accept-RangestAgetETagR"s Retry-AftertVarysContent-EncodingsContent-LengthR$sContent-Locations Content-MD5s Last-Modifiedis Content-Range(R R%R&thas_key(R R R%t respheadersR,((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyt clean_headerss     t HTTPErrorcBs8eZdZdddZdZdZdZRS(s Exception used to return an HTTP error code (4xx-5xx) to the client. This exception will automatically set the response status and body. A custom message (a long description to display in the browser) can be provided in place of the default. icCsZt||_}|dks+|dkr:tdn||_tj|||dS(NiiWs#status must be between 400 and 599.(RR Rt_messageRR(RR tmessage((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyRs  cCsddl}|j}t|j|j|_d}|jjrLt}nd|jd<|j |jd|d|j }||_ t ||jd %(status)s

%(status)s

%(message)s

%(traceback)s
c Ksddl}ytj|\}}}Wn,tk rV}|jd|jdnX|jddkrd||f|ds3In addition, the custom error page failed:
%s(R t_httpt valid_statusRR5R@tgetRt __version__t iteritemst_escapeRt error_pagetcallabletfiletreadt_format_exceptiont _exc_infot_HTTPErrorTemplate( R RAR tcodetreasonR7txtktvtpagesRMtetm((s7/usr/lib/python2.7/vendor-packages/cherrypy/_cperror.pyR;s@          iiiiiiiiiiiiicCsddl}|j}tj|d}|r|d7}|j}t|}|rv||krv|d||}n||_t||jds*i 4& 2