def check_delete_headers(request):
 if ('x-delete-after' in request.headers):
  try:
   x_delete_after = int(request.headers['x-delete-after'])
  except ValueError:
   raise HTTPBadRequest(request=request, content_type='text/plain', body='Non-integer X-Delete-After')
  actual_del_time = (time.time() + x_delete_after)
  if (actual_del_time < time.time()):
   raise HTTPBadRequest(request=request, content_type='text/plain', body='X-Delete-After in past')
  request.headers['x-delete-at'] = utils.normalize_delete_at_timestamp(actual_del_time)
 if ('x-delete-at' in request.headers):
  try:
   x_delete_at = int(utils.normalize_delete_at_timestamp(int(request.headers['x-delete-at'])))
  except ValueError:
   raise HTTPBadRequest(request=request, content_type='text/plain', body='Non-integer X-Delete-At')
  if (x_delete_at < time.time()):
   raise HTTPBadRequest(request=request, content_type='text/plain', body='X-Delete-At in past')
 return request

def check_delete_headers ( request ) : if ( 'x-delete-after' in request . headers ) : try : x_delete_after = int ( request . headers [ 'x-delete-after' ] ) except ValueError : raise HTTPBadRequest ( request = request , content_type = 'text/plain' , body = 'Non-integer X-Delete-After' ) actual_del_time = ( time . time ( ) + x_delete_after ) if ( actual_del_time < time . time ( ) ) : raise HTTPBadRequest ( request = request , content_type = 'text/plain' , body = 'X-Delete-After in past' ) request . headers [ 'x-delete-at' ] = utils . normalize_delete_at_timestamp ( actual_del_time ) if ( 'x-delete-at' in request . headers ) : try : x_delete_at = int ( utils . normalize_delete_at_timestamp ( int ( request . headers [ 'x-delete-at' ] ) ) ) except ValueError : raise HTTPBadRequest ( request = request , content_type = 'text/plain' , body = 'Non-integer X-Delete-At' ) if ( x_delete_at < time . time ( ) ) : raise HTTPBadRequest ( request = request , content_type = 'text/plain' , body = 'X-Delete-At in past' ) return request
validate if x-delete headers are have correct values values should be positive integers and correspond to a time in the future .