[dak/master 1/3] Add doc for session_wrapper.
Signed-off-by: Chris Lamb <lamby@debian.org>
---
daklib/dbconn.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 8ee9076..fb322ae 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -59,6 +59,12 @@ __all__ = ['IntegrityError', 'SQLAlchemyError']
################################################################################
def session_wrapper(fn):
+ """
+ Wrapper around common ".., session=None):" handling. If the wrapped
+ function is called without passing 'session', we create a local one
+ and destroy it when the function ends.
+ """
+
def wrapped(*args, **kwargs):
private_transaction = False
session = kwargs.get('session')
--
1.6.3.3
Reply to: