]> err.no Git - dak/commitdiff
Improve queries in dbconn.py using with_parent().
authorTorsten Werner <twerner@debian.org>
Sat, 22 Jan 2011 22:58:38 +0000 (23:58 +0100)
committerTorsten Werner <twerner@debian.org>
Sat, 22 Jan 2011 22:58:38 +0000 (23:58 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/dbconn.py

index 30aa7aaa3743c1d85463ad91d1c1e53f9a9c1fe8..83da5e9d92eb834a91591b342d0fd4698dd1458a 100755 (executable)
@@ -2501,8 +2501,7 @@ class Suite(object):
         @return: list of Architecture objects for the given name (may be empty)
         """
 
-        q = object_session(self).query(Architecture). \
-            filter(Architecture.suites.contains(self))
+        q = object_session(self).query(Architecture).with_parent(self)
         if skipsrc:
             q = q.filter(Architecture.arch_string != 'source')
         if skipall:
@@ -2525,7 +2524,7 @@ class Suite(object):
 
         session = object_session(self)
         return session.query(DBSource).filter_by(source = source). \
-            filter(DBSource.suites.contains(self))
+            with_parent(self)
 
 __all__.append('Suite')