]> git.decadent.org.uk Git - dak.git/commitdiff
Check whether suite is valid before referencing it (Closes: #634716)
authorLuca Falavigna <dktrkranz@debian.org>
Sun, 27 Nov 2011 12:44:17 +0000 (12:44 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Sun, 27 Nov 2011 12:44:17 +0000 (12:44 +0000)
Signed-off-by: Luca Falavigna <dktrkranz@debian.org>
daklib/dbconn.py

index 4a45ae2ef3c114ea970ebc73de659cd7ddfe1430..8c5806aa4944f9ea990ea59e95f7759d8450f8a5 100755 (executable)
@@ -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