Commits

Mike Bayer committed f233096

base begin method returns transaciton object

Comments (0)

Files changed (2)

lib/sqlalchemy/mapping/objectstore.py

 def begin():
     """begins a new UnitOfWork transaction.  the next commit will affect only
     objects that are created, modified, or deleted following the begin statement."""
-    get_session().begin()
+    return get_session().begin()
 
 def commit(*obj):
     """commits the current UnitOfWork transaction.  if a transaction was begun 

test/proxy_engine.py

         users.create()
         assign_mapper(User, users)
         try:
-            objectstore.begin()
+            trans = objectstore.begin()
 
             user = User()
             user.user_name='fred'
             user.password='*'
-            objectstore.commit()
+            trans.commit()
 
             # select
             sqluser = User.select_by(user_name='fred')[0]
                     module_engine.connect(db_uri)
                     users.create()
                     try:
-                        objectstore.begin()
+                        trans  = objectstore.begin()
 
                         all = User.select()[:]
                         assert all == []
                         u = User()
                         u.user_name = uname
                         u.password = 'whatever'
-                        objectstore.commit()
+                        trans.commit()
 
                         names = [ us.user_name for us in User.select() ]
                         assert names == [ uname ]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.