From: Chris Lamb Date: Tue, 27 Oct 2009 09:49:00 +0000 (+0000) Subject: Make dbconn.get_suite_src_formats use @session_wrapper. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1fee7b2e83c715efbaa7cc006a43d79bf0614c5;p=dak Make dbconn.get_suite_src_formats use @session_wrapper. Signed-off-by: Chris Lamb --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 98ebcaa1..aeffdcb3 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1992,6 +1992,7 @@ class SuiteSrcFormat(object): __all__.append('SuiteSrcFormat') +@session_wrapper def get_suite_src_formats(suite, session=None): """ Returns list of allowed SrcFormat for C{suite}. @@ -2007,22 +2008,12 @@ def get_suite_src_formats(suite, session=None): @return: the list of allowed source formats for I{suite} """ - privatetrans = False - if session is None: - session = DBConn().session() - privatetrans = True - q = session.query(SrcFormat) q = q.join(SuiteSrcFormat) q = q.join(Suite).filter_by(suite_name=suite) q = q.order_by('format_name') - ret = q.all() - - if privatetrans: - session.close() - - return ret + return q.all() __all__.append('get_suite_src_formats')