#NEWLINE# def MultiSet( self , subject , values , timestamp = None , replace = True , sync = True , to_delete = None , token = None ) : #NEWLINE# #INDENT# "Set multiple attributes' values for this subject in one operation." #NEWLINE# self . security_manager . CheckDataStoreAccess ( token , [ subject ] , 'w' ) #NEWLINE# to_delete = set ( ( to_delete or [ ] ) ) #NEWLINE# subject = utils . SmartUnicode ( subject ) #NEWLINE# to_insert = [ ] #NEWLINE# to_replace = [ ] #NEWLINE# transaction = [ ] #NEWLINE# for ( attribute , sequence ) in values . items ( ) : #NEWLINE# #INDENT# for value in sequence : #NEWLINE# #INDENT# if isinstance ( value , tuple ) : #NEWLINE# #INDENT# ( value , entry_timestamp ) = value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# entry_timestamp = timestamp #NEWLINE# #UNINDENT# if ( entry_timestamp is None ) : #NEWLINE# #INDENT# entry_timestamp = timestamp #NEWLINE# #UNINDENT# if ( entry_timestamp is not None ) : #NEWLINE# #INDENT# entry_timestamp = int ( entry_timestamp ) #NEWLINE# #UNINDENT# attribute = utils . SmartUnicode ( attribute ) #NEWLINE# data = self . _Encode ( value ) #NEWLINE# if ( replace or ( attribute in to_delete ) ) : #NEWLINE# #INDENT# existing = self . _CountExistingRows ( subject , attribute ) #NEWLINE# if existing : #NEWLINE# #INDENT# to_replace . append ( [ subject , attribute , data , entry_timestamp ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# to_insert . append ( [ subject , attribute , data , entry_timestamp ] ) #NEWLINE# #UNINDENT# if ( attribute in to_delete ) : #NEWLINE# #INDENT# to_delete . remove ( attribute ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# to_insert . append ( [ subject , attribute , data , entry_timestamp ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if to_delete : #NEWLINE# #INDENT# self . DeleteAttributes ( subject , to_delete , token = token ) #NEWLINE# #UNINDENT# if sync : #NEWLINE# #INDENT# if to_replace : #NEWLINE# #INDENT# transaction . extend ( self . _BuildReplaces ( to_replace ) ) #NEWLINE# #UNINDENT# if to_insert : #NEWLINE# #INDENT# transaction . extend ( self . _BuildInserts ( to_insert ) ) #NEWLINE# #UNINDENT# if transaction : #NEWLINE# #INDENT# self . _ExecuteTransaction ( transaction ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if to_replace : #NEWLINE# #INDENT# with self . buffer_lock : #NEWLINE# #INDENT# self . to_replace . extend ( to_replace ) #NEWLINE# #UNINDENT# #UNINDENT# if to_insert : #NEWLINE# #INDENT# with sync . buffer_lock : #NEWLINE# #INDENT# self . to_insert . extend ( to_insert )