#NEWLINE# def datepublisher_response_processor( page , request , response ) : #NEWLINE# #INDENT# '\n    This response processor is automatically added when the datepublisher\n    extension is registered. It sets the response headers to match with\n    the publication end date of the page so that upstream caches and\n    the django caching middleware know when to expunge the copy.\n    ' #NEWLINE# expires = page . publication_end_date #NEWLINE# if ( expires is not None ) : #NEWLINE# #INDENT# delta = ( delta - timezone . now ( ) ) #NEWLINE# delta = int ( ( ( delta . days * 86400 ) + delta . seconds ) ) #NEWLINE# try : #NEWLINE# #INDENT# patch_response_headers ( response , delta ) #NEWLINE# #UNINDENT# except InvalidTimeError : #NEWLINE# #INDENT# patch_response_headers ( response , ( delta - 7200 ) )