Esempio n. 1
0
 def test_transaction(self):
     with Transaction.begin():
         john = User(name='jonh')
         steve = User(name='steve')
         Transaction.add(john)
         Transaction.add(steve)
     self.assertEqual(3, len(User.all()))
Esempio n. 2
0
 def test_transaction(self):
     with Transaction.begin():
         john = User(name='jonh')
         steve = User(name='steve')
         Transaction.add(john)
         Transaction.add(steve)
     self.assertEqual(3, len(User.all()))
Esempio n. 3
0
 def trans():
     try:
         with Transaction.begin():
             john = User(id=999,name='jonh')
             steve = User(id=999,name='steve')
             Transaction.add(john)
             Transaction.add(steve)
     except SQLAlchemyError:
         Transaction.rollback()
         raise
Esempio n. 4
0
 def trans():
     try:
         with Transaction.begin():
             john = User(id=999, name='jonh')
             steve = User(id=999, name='steve')
             Transaction.add(john)
             Transaction.add(steve)
     except SQLAlchemyError:
         Transaction.rollback()
         raise