#NEWLINE# def _parse_body( self , robj , response , expected_statuses ) : #NEWLINE# #INDENT# '\n        Parse the body of an object response and populate the object.\n        ' #NEWLINE# if ( response is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# ( status , headers , data ) = response #NEWLINE# if ( not status ) : #NEWLINE# #INDENT# m = 'Could not contact Riak Server: http://{0}:{1}!' . format ( self . _node . host , self . _node . http_port ) #NEWLINE# raise RiakError ( m ) #NEWLINE# #UNINDENT# self . check_http_code ( status , expected_statuses ) #NEWLINE# if ( 'x-riak-vclock' in headers ) : #NEWLINE# #INDENT# robj . vclock = VClock ( headers [ 'x-riak-vclock' ] , 'base64' ) #NEWLINE# #UNINDENT# if ( status == 404 ) : #NEWLINE# #INDENT# robj . siblings = [ ] #NEWLINE# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( status == 201 ) : #NEWLINE# #INDENT# robj . key = headers [ 'location' ] . strip ( ) . split ( '/' ) [ ( - 1 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( status == 300 ) : #NEWLINE# #INDENT# ( ctype , params ) = parse_header ( headers [ 'content-type' ] ) #NEWLINE# if ( ctype == 'multipart/mixed' ) : #NEWLINE# #INDENT# if PY3 : #NEWLINE# #INDENT# data = bytes_to_str ( data ) #NEWLINE# #UNINDENT# boundary = re . compile ( ( '\r?\n--%s(?:--)?\r?\n' % re . escape ( params [ 'boundary' ] ) ) ) #NEWLINE# parts = [ message_from_string ( p ) for p in re . split ( boundary , data ) [ 1 : ( - 1 ) ] ] #NEWLINE# robj . siblings = [ self . _parse_sibling ( RiakContent ( robj ) , part . items ( ) , part . get_payload ( ) ) for part in parts ] #NEWLINE# if ( robj . resolver is not None ) : #NEWLINE# #INDENT# robj . resolver ( robj ) #NEWLINE# #UNINDENT# return robj #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( 'unexpected sibling response format: {0}' . format ( ctype ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# robj . siblings = [ self . _parse_sibling ( RiakContent ( robj ) , headers . items ( ) , data ) ] #NEWLINE# return robj