#NEWLINE# def save( self ) : #NEWLINE# #INDENT# ( attributes , numNewContentChunks ) = self . toItem ( ) #NEWLINE# expected = [ 'version' , ( False if ( self . previousVersion is None ) else self . previousVersion ) ] #NEWLINE# try : #NEWLINE# #INDENT# for attempt in retry_sdb ( ) : #NEWLINE# #INDENT# with attempt : #NEWLINE# #INDENT# assert self . outer . filesDomain . put_attributes ( item_name = self . fileID , attributes = attributes , expected_value = expected ) #NEWLINE# #UNINDENT# #UNINDENT# if self . previousVersion : #NEWLINE# #INDENT# self . outer . filesBucket . delete_key ( self . fileID , version_id = self . previousVersion ) #NEWLINE# #UNINDENT# self . _previousVersion = self . _version #NEWLINE# if ( numNewContentChunks < self . _numContentChunks ) : #NEWLINE# #INDENT# residualChunks = xrange ( numNewContentChunks , self . _numContentChunks ) #NEWLINE# attributes = [ self . _chunkName ( i ) for i in residualChunks ] #NEWLINE# for attempt in retry_sdb ( ) : #NEWLINE# #INDENT# with attempt : #NEWLINE# #INDENT# self . outer . filesDomain . delete_attributes ( self . fileID , attributes = attributes ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . _numContentChunks = numNewContentChunks #NEWLINE# #UNINDENT# except SDBResponseError as e : #NEWLINE# #INDENT# if ( e . error_code == 'ConditionalCheckFailed' ) : #NEWLINE# #INDENT# raise ConcurrentFileModificationException ( self . fileID ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise