#NEWLINE# def add( self , state ) : #NEWLINE# #INDENT# if ( state . key in state ) : #NEWLINE# #INDENT# if ( attributes . instance_state ( self . _dict [ state . key ] ) is not state ) : #NEWLINE# #INDENT# raise sa_exc . InvalidRequestError ( ( "Can't attach instance %s; another instance with key %s is already present in this session." % ( orm_util . state_str ( state ) , state . key ) ) ) #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _dict [ state . key ] = state . obj ( ) #NEWLINE# self . _manage_incoming_state ( state ) #NEWLINE# return True