From: Chris Lamb Date: Tue, 27 Oct 2009 08:55:06 +0000 (+0000) Subject: Add doc for session_wrapper. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a44e7de5fff597b9c2e04de3d22ae57422060f65;p=dak Add doc for session_wrapper. Signed-off-by: Chris Lamb --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 8ee90768..fb322aea 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')