OwlCyberSecurity - MANAGER
Edit File: iweb.pyc
� �t�ac @ s2 d Z d d l m Z m Z m Z d e f d � � YZ e � Z d e j f d � � YZ e e _ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d d l m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d d d d d d d d d g Z d S( s� I contain the interfaces for several web related objects including IRequest and IResource. I am based heavily on ideas from C{nevow.inevow}. i����( t Attributet Interfacet interfacet IResourcec B s e Z d Z d � Z d � Z RS( s� An HTTP resource. I serve 2 main purposes: one is to provide a standard representation for what HTTP specification calls an 'entity', and the other is to provide an mechanism for mapping URLs to content. c C s d S( s� Locate another object which can be adapted to IResource. @return: A 2-tuple of (resource, remaining-path-segments), or a deferred which will fire the above. Causes the object publishing machinery to continue on with specified resource and segments, calling the appropriate method on the specified resource. If you return (self, L{server.StopTraversal}), this instructs web2 to immediately stop the lookup stage, and switch to the rendering stage, leaving the remaining path alone for your render function to handle. N( ( t reqt segments( ( s /opt/cpanel-ccs/txweb2/iweb.pyt locateChild- t c C s d S( s� Return an IResponse or a deferred which will fire an IResponse. This response will be written to the web browser which initiated the request. N( ( R ( ( s /opt/cpanel-ccs/txweb2/iweb.pyt renderHTTP? R ( t __name__t __module__t __doc__R R ( ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR $ s t SpecialAdaptInterfaceClassc B s e Z e d � Z RS( c C s| t t | � j | | � } | | k r+ | St | | � } | | k rV t | � } | S| t k rf | St d | | � � d S( Ns Could not adapt( t superR t __call__t IOldNevowResourceR t _defaultt TypeError( t selft othert alternatet result( ( s /opt/cpanel-ccs/txweb2/iweb.pyR N s ( R R R R ( ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR J s R c B s e Z d Z d � Z d � Z RS( s I am a web resource. c C s d S( s{ Locate another object which can be adapted to IResource Return a tuple of resource, path segments N( ( t ctxR ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR c R c C s d S( sv Return a string or a deferred which will fire a string. This string will be written to the web browser which initiated this request. Unlike iweb.IResource, this expects the incoming data to have already been read and parsed into request.args and request.content, and expects to return a string instead of a response object. N( ( R ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR i R ( R R R R R ( ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR ] s t ICanHandleExceptionc B s e Z d � Z d � Z RS( c C s d S( sB Render an exception to the given request object. N( ( t requestt failure( ( s /opt/cpanel-ccs/txweb2/iweb.pyt renderHTTP_exceptionw R c C s d S( sk Return stan representing the exception, to be printed in the page, not replacing the page.N( ( R t reason( ( s /opt/cpanel-ccs/txweb2/iweb.pyt renderInlineException| R ( R R R R ( ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR t s t IResponsec B s2 e Z d Z e d � Z e d � Z e d � Z RS( s I'm a response. s The HTTP response codes2 A http_headers.Headers instance of headers to sends4 A stream.IByteStream of outgoing data, or else None.( R R R R t codet headerst stream( ( ( s /opt/cpanel-ccs/txweb2/iweb.pyR � s t IRequestc B s_ e Z d Z e d � Z e d � Z e d � Z e d � Z e d � Z d � Z e d � Z RS( s+ I'm a request for a web resource. s/ The HTTP method from the request line, e.g. GETs? The raw URI from the request line. May or may not include host.s- Protocol from the request line, e.g. HTTP/1.1s4 A http_headers.Headers instance of incoming headers.s&