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

[PATCH 2/2] Find suite by any of the random name types we have



Signed-off-by: Mark Hymers <mhy@debian.org>
---
 daklib/dbconn.py |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 535c7f8..4d1035c 100644
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -2298,8 +2298,22 @@ def get_suite(suite, session=None):
     @return: Suite object for the requested suite name (None if not present)
     """
 
+    # Start by looking for the dak internal name
     q = session.query(Suite).filter_by(suite_name=suite)
+    try:
+        return q.one()
+    except NoResultFound:
+        pass
+
+    # Now try codename
+    q = session.query(Suite).filter_by(codename=suite)
+    try:
+        return q.one()
+    except NoResultFound:
+        pass
 
+    # Finally give release_suite a try
+    q = session.query(Suite).filter_by(release_suite=suite)
     try:
         return q.one()
     except NoResultFound:
-- 
1.7.10.4


Reply to: