]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added *args **kwargs pass-thru to transaction()
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 25 Mar 2006 20:32:10 +0000 (20:32 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 25 Mar 2006 20:32:10 +0000 (20:32 +0000)
lib/sqlalchemy/engine.py

index dcb14af8612c6a3e41f075f47b917b0c56773073..c804680e629e00a0a8146cfbb6c1ea81b36c8c1d 100644 (file)
@@ -492,12 +492,14 @@ class SQLEngine(schema.SchemaEngine):
         for engine in engines:
             engine.commit()
             
-    def transaction(self, func):
+    def transaction(self, func, *args, **kwargs):
         """executes the given function within a transaction boundary.  this is a shortcut for
-        explicitly calling begin() and commit() and optionally rollback() when execptions are raised."""
+        explicitly calling begin() and commit() and optionally rollback() when execptions are raised.
+        The given *args and **kwargs will be passed to the function as well, which could be handy
+        in constructing decorators."""
         self.begin()
         try:
-            func()
+            func(*args, **kwargs)
         except:
             self.rollback()
             raise