X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=fb322aeaf674e22fa455c6af95c84e004f8d8f78;hb=a44e7de5fff597b9c2e04de3d22ae57422060f65;hp=8ee9076874d09a0d785924cb4bf3eb891e9b41b9;hpb=46e78dc7379a831bcd05fe86f218d3f4753d26d5;p=dak.git 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')