From: Luca Falavigna Date: Sun, 27 Nov 2011 12:44:17 +0000 (+0000) Subject: Check whether suite is valid before referencing it (Closes: #634716) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ded826ce225127e11ebfe13cb1c64d76e4b772a8;p=dak Check whether suite is valid before referencing it (Closes: #634716) Signed-off-by: Luca Falavigna --- 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