From d1fee7b2e83c715efbaa7cc006a43d79bf0614c5 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 27 Oct 2009 09:49:00 +0000 Subject: [PATCH] Make dbconn.get_suite_src_formats use @session_wrapper. Signed-off-by: Chris Lamb --- daklib/dbconn.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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') -- 2.39.5