#NEWLINE# def set_status( self , rows , status , comment = None ) : #NEWLINE# #INDENT# ( rows_by_batch_id , batch_id ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , 1 ) #NEWLINE# if isinstance ( status , int ) : #NEWLINE# #INDENT# status = moderation_statuses [ status ] #NEWLINE# #UNINDENT# batches = E . Batch ( ListVersion = '1' , OnError = 'Return' ) #NEWLINE# xml = SP . UpdateListItems ( SP . listName ( self . _list . id ) , SP . updates ( batches ) ) #NEWLINE# if comment : #NEWLINE# #INDENT# comment = E . Field ( unicode ( comment ) , Name = '_ModerationComment' ) #NEWLINE# #UNINDENT# for row in rows : #NEWLINE# #INDENT# batch = E . Method ( E . Field ( unicode ( row . id ) , Name = 'ID' ) , E . Field ( unicode ( status . value ) , Name = '_ModerationStatus' ) , ID = unicode ( batch_id ) , Cmd = 'Moderate' ) #NEWLINE# if comment : #NEWLINE# #INDENT# batch . append ( comment ) #NEWLINE# #UNINDENT# rows_by_batch_id [ batch_id ] = row #NEWLINE# batches . append ( batch ) #NEWLINE# batch_id += 1 #NEWLINE# #UNINDENT# response = self . _list . opener . post_soap ( LIST_WEBSERVICE , xml , soapaction = 'http://schemas.microsoft.com/sharepoint/soap/UpdateListItems' ) #NEWLINE# for result in response . xpath ( './/sp:Result' , namespaces = namespaces ) : #NEWLINE# #INDENT# ( batch_id , batch_result ) = result . attrib [ 'ID' ] . split ( ',' ) #NEWLINE# row = rows_by_batch_id [ int ( batch_id ) ] #NEWLINE# error_code = result . find ( 'sp:ErrorCode' , namespaces = namespaces ) #NEWLINE# error_text = result . find ( 'sp:ErrorText' , namespaces = namespaces ) #NEWLINE# if ( ( error_code is not None ) and ( error_code . text != '0x00000000' ) ) : #NEWLINE# #INDENT# raise UpdateFailedError ( row , batch_result , error_code . text , error_text . text ) #NEWLINE# #UNINDENT# if ( batch_result == 'Moderate' ) : #NEWLINE# #INDENT# row . _update ( result . xpath ( 'z:row' , namespaces = namespaces ) [ 0 ] , clear = True )