def add_caching_to_response(response, request=None, etag=None):
 if (not etag):
  if ('Cache-Control' not in response.headers):
   response.headers['Cache-Control'] = 'no-cache'
  return
 assert (request is not None)
 if (response.code not in (200, 304)):
  return
 response.headers['Etag'] = etag
 if ('Access-Control-Allow-Origin' not in response.headers):
  response.headers['Access-Control-Allow-Origin'] = 'https://gratipay.com'
 if request.line.uri.querystring.get('etag'):
  response.headers['Cache-Control'] = 'public, max-age=31536000'
 else:
  response.headers['Cache-Control'] = 'public, max-age=5'

def add_caching_to_response ( response , request = None , etag = None ) : if ( not etag ) : if ( 'Cache-Control' not in response . headers ) : response . headers [ 'Cache-Control' ] = 'no-cache' return assert ( request is not None ) if ( response . code not in ( 200 , 304 ) ) : return response . headers [ 'Etag' ] = etag if ( 'Access-Control-Allow-Origin' not in response . headers ) : response . headers [ 'Access-Control-Allow-Origin' ] = 'https://gratipay.com' if request . line . uri . querystring . get ( 'etag' ) : response . headers [ 'Cache-Control' ] = 'public, max-age=31536000' else : response . headers [ 'Cache-Control' ] = 'public, max-age=5'
set caching headers .