def follow_subrequest(request, subrequest, **kwargs):
 try:
  try:
   return (request.invoke_subrequest(subrequest, **kwargs), subrequest)
  except Exception as e:
   resp = render_view_to_response(e, subrequest)
   if ((not resp) or (resp.status_code >= 500)):
    raise e
   raise resp
 except httpexceptions.HTTPRedirection as e:
  new_location = e.headers['Location']
  new_request = Request.blank(path=new_location, headers=subrequest.headers, POST=subrequest.body, method=subrequest.method)
  new_request.bound_data = subrequest.bound_data
  new_request.parent = getattr(subrequest, 'parent', None)
  return (request.invoke_subrequest(new_request, **kwargs), new_request)

def follow_subrequest ( request , subrequest , ** kwargs ) : try : try : return ( request . invoke_subrequest ( subrequest , ** kwargs ) , subrequest ) except Exception as e : resp = render_view_to_response ( e , subrequest ) if ( ( not resp ) or ( resp . status_code >= 500 ) ) : raise e raise resp except httpexceptions . HTTPRedirection as e : new_location = e . headers [ 'Location' ] new_request = Request . blank ( path = new_location , headers = subrequest . headers , POST = subrequest . body , method = subrequest . method ) new_request . bound_data = subrequest . bound_data new_request . parent = getattr ( subrequest , 'parent' , None ) return ( request . invoke_subrequest ( new_request , ** kwargs ) , new_request )
run a subrequest .