def ParseStatusRewriter(response):
 location_value = response.headers.getheader('location')
 status_value = response.headers.getheader('status')
 if status_value:
  response_status = status_value
  del response.headers['status']
 elif location_value:
  response_status = ('%d Redirecting' % httplib.FOUND)
 else:
  return response
 status_parts = response_status.split(' ', 1)
 (response.status_code, response.status_message) = (status_parts + [''])[:2]
 try:
  response.status_code = int(response.status_code)
 except ValueError:
  response.status_code = 500
  response.body = cStringIO.StringIO('Error: Invalid "status" header value returned.')

def ParseStatusRewriter ( response ) : location_value = response . headers . getheader ( 'location' ) status_value = response . headers . getheader ( 'status' ) if status_value : response_status = status_value del response . headers [ 'status' ] elif location_value : response_status = ( '%d Redirecting' % httplib . FOUND ) else : return response status_parts = response_status . split ( ' ' , 1 ) ( response . status_code , response . status_message ) = ( status_parts + [ '' ] ) [ : 2 ] try : response . status_code = int ( response . status_code ) except ValueError : response . status_code = 500 response . body = cStringIO . StringIO ( 'Error: Invalid "status" header value returned.' )
parse status header .