#NEWLINE# def post_commit( self , results ) : #NEWLINE# #INDENT# 'Process results after a commit.\n\n:parameter results: iterator over :class:`stdnet.instance_session_result`\n    items.\n:rtype: a two elements tuple containing a list of instances saved and\n    a list of ids of instances deleted.' #NEWLINE# tpy = self . _meta . pk_to_python #NEWLINE# instances = [ ] #NEWLINE# deleted = [ ] #NEWLINE# errors = [ ] #NEWLINE# for result in results : #NEWLINE# #INDENT# if isinstance ( result , Exception ) : #NEWLINE# #INDENT# errors . append ( result . __class__ ( ( 'Exception while committing %s. %s' % ( self . _meta , result ) ) ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# instance = self . pop ( result . iid ) #NEWLINE# id = tpy ( result . id , self . backend ) #NEWLINE# if result . deleted : #NEWLINE# #INDENT# deleted . append ( id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( instance is None ) : #NEWLINE# #INDENT# raise InvalidTransaction ( '{0} session received id "{1}" which is not in the session.' . format ( self , result . iid ) ) #NEWLINE# #UNINDENT# setattr ( instance , instance . _meta . pkname ( ) , id ) #NEWLINE# instance = self . add ( instance , modified = False , persistent = result . persistent ) #NEWLINE# instance . get_state ( ) . score = result . score #NEWLINE# if instance . get_state ( ) . persistent : #NEWLINE# #INDENT# instances . append ( instance ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( instances , deleted , errors )