#NEWLINE# def __set_xml_response( self , message_body ) : #NEWLINE# #INDENT# self . xml_document = message_body . decode ( _encoding ) #NEWLINE# try : #NEWLINE# #INDENT# element = etree . fromstring ( message_body ) #NEWLINE# #UNINDENT# except etree . ParseError as msg : #NEWLINE# #INDENT# self . status_detail = ( 'ElementTree.fromstring ParseError: %s' % msg ) #NEWLINE# return False #NEWLINE# #UNINDENT# except MemoryError as msg : #NEWLINE# #INDENT# self . status_detail = ( 'ElementTree.fromstring MemoryError: %s' % msg ) #NEWLINE# return False #NEWLINE# #UNINDENT# except Exception as msg : #NEWLINE# #INDENT# self . status_detail = ( '%s: %s' % ( sys . exc_info ( ) [ 0 ] . __name__ , element ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# self . element_root = element #NEWLINE# self . element_result = self . element_root . find ( 'result' ) #NEWLINE# if ( self . element_result is None ) : #NEWLINE# #INDENT# self . element_result = self . element_root . find ( 'report/result' ) #NEWLINE# #UNINDENT# self . _log ( DEBUG3 , 'xml_document: %s' , self . xml_document ) #NEWLINE# self . _log ( DEBUG3 , 'message_body: %s' , type ( message_body ) ) #NEWLINE# self . _log ( DEBUG3 , 'message_body.decode(): %s' , type ( self . xml_document ) ) #NEWLINE# response_attrib = self . element_root . attrib #NEWLINE# if ( not response_attrib ) : #NEWLINE# #INDENT# self . status_detail = 'no response element status attribute' #NEWLINE# return False #NEWLINE# #UNINDENT# self . _log ( DEBUG2 , 'response_attrib: %s' , response_attrib ) #NEWLINE# if ( 'status' in response_attrib ) : #NEWLINE# #INDENT# self . status = response_attrib [ 'status' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . status = 'success' #NEWLINE# #UNINDENT# if ( 'code' in response_attrib ) : #NEWLINE# #INDENT# self . status_code = response_attrib [ 'code' ] #NEWLINE# #UNINDENT# self . status_detail = self . __get_response_msg ( ) #NEWLINE# if ( self . status == 'success' ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False