#NEWLINE# def request( self , method , url , headers = None , body = None ) : #NEWLINE# #INDENT# '\n        Find the child of C{self.resource} for the given request and\n        render it to generate a response.\n        ' #NEWLINE# if ( headers is None ) : #NEWLINE# #INDENT# headers = Headers ( ) #NEWLINE# #UNINDENT# content = BytesIO ( ) #NEWLINE# if ( body is None ) : #NEWLINE# #INDENT# reading = defer . succeed ( None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reading = body . startProducing ( content ) #NEWLINE# #UNINDENT# def finishedReading( ignored ) : #NEWLINE# #INDENT# request = dummyRequest ( method , url , headers , content . getvalue ( ) ) #NEWLINE# resource = getChildForRequest ( self . resource , request ) #NEWLINE# d = render ( resource , request ) #NEWLINE# d . addCallback ( ( lambda ignored : request ) ) #NEWLINE# return d #NEWLINE# #UNINDENT# rendering = reading . addCallback ( finishedReading ) #NEWLINE# def rendered( request ) : #NEWLINE# #INDENT# return _MemoryResponse ( ( b'HTTP' , 1 , 1 ) , request . _code , request . _message , request . responseHeaders , request , None , request . _responseBody ) #NEWLINE# #UNINDENT# rendering . addCallback ( rendering ) #NEWLINE# return reading