Ic@sjdZddklZddklZddklZ ddk l Z ddk lZdefdYZd efd YZd efd YZd efdYZdZdefdYZdefdYZdZdZh 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.6/vendor-packages/cherrypy/_cperror.pyR st TimeoutErrorcBseZdZRS(s5Exception raised when Response.timed_out is detected.(RRt__doc__(((s7/usr/lib/python2.6/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. cCsddk}|i}d|_d|jo|idd\}|_nt|i|}||_ti|||idS(Nitt?i( tcherrypytrequestt query_stringtsplitt_urljoint path_infotpathRt__init__(tselfRR R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyRs     (RRR R(((s7/usr/lib/python2.6/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. cCsddk}|i}t|to |g}ng}x0|D](}t|i|}|i|q?W||_|djo$|i djo d}qd}n7t |}|djp |djot dn||_ t i|||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.6/vendor-packages/cherrypy/_cperror.pyR8s&         c Csddk}|i}|i|_}|djod|id <|id |id %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 tmsgt_[1]tutkey((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyt set_responseZs:     :    cCs |dS(s5Use this exception as a request.handler (raise self).N((R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyt__call__sN(RRR RRR.R/(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyR/s " 9c Csddk}|i}|i}xMddddddd d d d d dg D]!}|i|o ||=qIqIW|djo|ido |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.6/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. icCs]t||_}|djp |djotdn||_ti|||dS(NiiWs#status must be between 400 and 599.(RR Rt_messageRR(RR tmessage((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyRs  cCsddk}|i}t|i|i|_d}|iio t}nd|id<|i |id|d|i }||_ t ||id %(status)s

%(status)s

%(message)s

%(traceback)s
c Ksddk}yti|\}}}Wn.tj o"}|id|idnX|iddjod||f|ds3In addition, the custom error page failed:
%s(R t_httpt valid_statusRR6RAtgetRt __version__t iteritemst_escapeRt error_pagetcallabletfiletreadt_format_exceptiont _exc_infot_HTTPErrorTemplate( R RBR tcodetreasonR8txtktvtpagesRNtetm((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyR<sB       iiiiiiiiiiiiicCsddk}|i}ti|d}|ol|d7}|i}t|}|o#||jo|d||}n||_t||idGs      cCsN|djo t}n|djodSddk}di|i|S(s0Return exc (or sys.exc_info if None), formatted.R iN(NNN(RRSR9R'R(texcR9((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyR;_s     cCsMd}|dj o|d|7}ndddtt|fg|gfS( sProduce status, headers, body for a critical error. Returns a triple without calling any other questionable functions, so it should be as error-free as possible. Call it from an HTTP server if you get errors outside of the request. If extrabody is None, a friendly but rather unhelpful error message is set in the body. If extrabody is a string, it will be appended as-is to the body. s"Unrecoverable error in the server.s s500 Internal Server Errors Content-Types text/plainsContent-LengthN(s Content-Types text/plain(RtstrR=(t extrabodyR(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyt bare_errorhs N(R tcgiRRMtsysRRSR9RRRturlparseRRt cherrypy.libRRHt ExceptionRRR RR5R6RCRTR<R^R>RR;Re(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cperror.pyts*i 4& 2