#NEWLINE# @ webob . dec . wsgify ( RequestClass = Request ) #NEWLINE# def __call__( self , req ) : #NEWLINE# #INDENT# 'Generate a WSGI response based on the exception passed to ctor.' #NEWLINE# code = self . wrapped_exc . status_int #NEWLINE# explanation = self . wrapped_exc . explanation #NEWLINE# LOG . debug ( 'Returning %(code)s to user: %(explanation)s' , { #NEWLINE# #INDENT# 'code' : code , #NEWLINE# 'explanation' : explanation , #NEWLINE# #UNINDENT# } ) #NEWLINE# def_ct = 'text/plain' #NEWLINE# content_type = req . get_best_match_content_type ( default_match = def_ct ) #NEWLINE# mtype = serializers . get_media_map ( ) . get ( self , 'text' ) #NEWLINE# serializer = serializers . get_default_serializers ( ) [ mtype ] #NEWLINE# env = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# serialized_exc = serializer ( env ) . serialize ( self . wrapped_exc ) #NEWLINE# self . wrapped_exc . content_type = content_type #NEWLINE# self . wrapped_exc . body = serialized_exc [ 1 ] #NEWLINE# if ( content_type == 'text/occi' ) : #NEWLINE# #INDENT# req . method = 'HEAD' #NEWLINE# #UNINDENT# return self . wrapped_exc