From ded826ce225127e11ebfe13cb1c64d76e4b772a8 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Sun, 27 Nov 2011 12:44:17 +0000 Subject: [PATCH] Check whether suite is valid before referencing it (Closes: #634716) Signed-off-by: Luca Falavigna --- daklib/dbconn.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 4a45ae2e..8c5806aa 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2556,11 +2556,12 @@ def source_exists(source, source_version, suites = ["any"], session=None): if suite != "any": # source must exist in 'suite' or a suite that is enhanced by 'suite' s = get_suite(suite, session) - enhances_vcs = session.query(VersionCheck).filter(VersionCheck.suite==s).filter_by(check='Enhances') - considered_suites = [ vc.reference for vc in enhances_vcs ] - considered_suites.append(s) + if s: + enhances_vcs = session.query(VersionCheck).filter(VersionCheck.suite==s).filter_by(check='Enhances') + considered_suites = [ vc.reference for vc in enhances_vcs ] + considered_suites.append(s) - q = q.filter(DBSource.suites.any(Suite.suite_id.in_([s.suite_id for s in considered_suites]))) + q = q.filter(DBSource.suites.any(Suite.suite_id.in_([s.suite_id for s in considered_suites]))) if q.count() > 0: continue -- 2.39.5