#NEWLINE# def make_conditional( self , request_or_environ ) : #NEWLINE# #INDENT# "Make the response conditional to the request.  This method works\n        best if an etag was defined for the response already.  The `add_etag`\n        method can be used to do that.  If called without etag just the date\n        header is set.\n\n        This does nothing if the request method in the request or environ is\n        anything but GET or HEAD.\n\n        It does not remove the body of the response because that's something\n        the :meth:`__call__` function does for us automatically.\n\n        Returns self so that you can do ``return resp.make_conditional(req)``\n        but modifies the object in-place.\n\n        :param request_or_environ: a request object or WSGI environment to be\n                                   used to make the response conditional\n                                   against.\n        " #NEWLINE# environ = _get_environ ( request_or_environ ) #NEWLINE# if ( environ [ 'REQUEST_METHOD' ] in ( 'GET' , 'HEAD' ) ) : #NEWLINE# #INDENT# if ( 'date' not in self . headers ) : #NEWLINE# #INDENT# self . headers [ 'Date' ] = http_date ( ) #NEWLINE# #UNINDENT# if ( 'content-length' not in self . headers ) : #NEWLINE# #INDENT# length = self . calculate_content_length ( ) #NEWLINE# if ( length is not None ) : #NEWLINE# #INDENT# self . headers [ 'Content-Length' ] = length #NEWLINE# #UNINDENT# #UNINDENT# if ( not is_resource_modified ( environ , self . headers . get ( 'etag' ) , None , self . headers . get ( 'last-modified' ) ) ) : #NEWLINE# #INDENT# self . status_code = 304 #NEWLINE# #UNINDENT# #UNINDENT# return self