def propagate_exchange(cursor, participant, route, error, amount):
 route.update_error((error or u''))
 new_balance = cursor.one(u'\n        UPDATE participants\n           SET balance=(balance + %s)\n         WHERE id=%s\n     RETURNING balance\n    ', (amount, participant.id))
 if ((amount < 0) and (new_balance < 0)):
  raise NegativeBalance
 if hasattr(participant, u'set_attributes'):
  participant.set_attributes(balance=new_balance)

def propagate_exchange ( cursor , participant , route , error , amount ) : route . update_error ( ( error or u'' ) ) new_balance = cursor . one ( u'\n        UPDATE participants\n           SET balance=(balance + %s)\n         WHERE id=%s\n     RETURNING balance\n    ' , ( amount , participant . id ) ) if ( ( amount < 0 ) and ( new_balance < 0 ) ) : raise NegativeBalance if hasattr ( participant , u'set_attributes' ) : participant . set_attributes ( balance = new_balance )
propagates an exchanges result to the participants balance and the routes status .