def default_serialize_error(req, resp, exception):
 representation = None
 preferred = req.client_prefers(('application/xml', 'text/xml', 'application/json'))
 if (preferred is None):
  accept = req.accept.lower()
  if ('+json' in accept):
   preferred = 'application/json'
  elif ('+xml' in accept):
   preferred = 'application/xml'
 if (preferred is not None):
  if (preferred == 'application/json'):
   representation = exception.to_json()
  else:
   representation = exception.to_xml()
  resp.body = representation
  resp.content_type = (preferred + '; charset=UTF-8')
 resp.append_header('Vary', 'Accept')

def default_serialize_error ( req , resp , exception ) : representation = None preferred = req . client_prefers ( ( 'application/xml' , 'text/xml' , 'application/json' ) ) if ( preferred is None ) : accept = req . accept . lower ( ) if ( '+json' in accept ) : preferred = 'application/json' elif ( '+xml' in accept ) : preferred = 'application/xml' if ( preferred is not None ) : if ( preferred == 'application/json' ) : representation = exception . to_json ( ) else : representation = exception . to_xml ( ) resp . body = representation resp . content_type = ( preferred + '; charset=UTF-8' ) resp . append_header ( 'Vary' , 'Accept' )
serialize the given instance of httperror .