def patch_vary_headers(response, newheaders):
 if response.has_header(u'Vary'):
  vary_headers = cc_delim_re.split(response[u'Vary'])
 else:
  vary_headers = []
 existing_headers = set([header.lower() for header in vary_headers])
 additional_headers = [newheader for newheader in newheaders if (newheader.lower() not in existing_headers)]
 response[u'Vary'] = u', '.join((vary_headers + additional_headers))

def patch_vary_headers ( response , newheaders ) : if response . has_header ( u'Vary' ) : vary_headers = cc_delim_re . split ( response [ u'Vary' ] ) else : vary_headers = [ ] existing_headers = set ( [ header . lower ( ) for header in vary_headers ] ) additional_headers = [ newheader for newheader in newheaders if ( newheader . lower ( ) not in existing_headers ) ] response [ u'Vary' ] = u', ' . join ( ( vary_headers + additional_headers ) )
adds the "vary" header in the given httpresponse object .