X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=624ff8b5c83e6b2dbf30186f147bbf4f8d941cef;hb=bdd3bf92a9dbccf8313b7f0bad97381f5f51a189;hp=988309361b3bef1fa2295c8184bedc8f60eddc31;hpb=321e814e04b7e01820120fd888e55975dafc240a;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 98830936..624ff8b5 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2089,27 +2089,28 @@ __all__.append('get_sources_from_name') # FIXME: This function fails badly if it finds more than 1 source package and # its implementation is trivial enough to be inlined. @session_wrapper -def get_source_in_suite(source, suite, session=None): +def get_source_in_suite(source, suite_name, session=None): """ - Returns a DBSource object for a combination of C{source} and C{suite}. + Returns a DBSource object for a combination of C{source} and C{suite_name}. - B{source} - source package name, eg. I{mailfilter}, I{bbdb}, I{glibc} - - B{suite} - a suite name, eg. I{unstable} + - B{suite_name} - a suite name, eg. I{unstable} @type source: string @param source: source package name - @type suite: string + @type suite_name: string @param suite: the suite name @rtype: string @return: the version for I{source} in I{suite} """ - - q = get_suite(suite, session).get_sources(source) + suite = get_suite(suite_name, session) + if suite is None: + return None try: - return q.one() + return suite.get_sources(source).one() except NoResultFound: return None