#NEWLINE# def process_response( self , request , response ) : #NEWLINE# #INDENT# 'Send broken link emails and calculate the Etag, if needed.' #NEWLINE# if ( response . status_code == 404 ) : #NEWLINE# #INDENT# if ( settings . SEND_BROKEN_LINK_EMAILS and ( not settings . DEBUG ) ) : #NEWLINE# #INDENT# domain = request . get_host ( ) #NEWLINE# referer = request . META . get ( 'HTTP_REFERER' , None ) #NEWLINE# is_internal = _is_internal_request ( domain , referer ) #NEWLINE# path = request . get_full_path ( ) #NEWLINE# if ( referer and ( not _is_ignorable_404 ( path ) ) and ( is_internal or ( '?' not in referer ) ) ) : #NEWLINE# #INDENT# ua = request . META . get ( 'HTTP_USER_AGENT' , '<none>' ) #NEWLINE# ip = request . META . get ( 'REMOTE_ADDR' , '<none>' ) #NEWLINE# mail_managers ( ( 'Broken %slink on %s' % ( ( ( is_internal and 'INTERNAL ' ) or '' ) , domain ) ) , ( 'Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n' % ( referer , request . get_full_path ( ) , ua , ip ) ) , fail_silently = True ) #NEWLINE# #UNINDENT# return response #NEWLINE# #UNINDENT# #UNINDENT# if settings . USE_ETAGS : #NEWLINE# #INDENT# if response . has_header ( 'ETag' ) : #NEWLINE# #INDENT# etag = response [ 'ETag' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# etag = ( '"%s"' % hashlib . md5 ( response . content ) . hexdigest ( ) ) #NEWLINE# #UNINDENT# if ( ( response . status_code >= 200 ) and ( response . status_code < 300 ) and ( request . META . get ( 'HTTP_IF_NONE_MATCH' ) == etag ) ) : #NEWLINE# #INDENT# cookies = response . cookies #NEWLINE# response = http . HttpResponseNotModified ( ) #NEWLINE# response . cookies = cookies #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response [ 'ETag' ] = etag #NEWLINE# #UNINDENT# #UNINDENT# return response