[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Check whether suite is valid before referencing it (Closes: #634716)



Signed-off-by: Luca Falavigna <dktrkranz@debian.org>
---
 daklib/dbconn.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 4a45ae2..8c5806a 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
-- 
1.7.2.5


Reply to: