From d733acb0b123077f9c1f899130ef24ed4d74bc7a Mon Sep 17 00:00:00 2001 From: Mark Hymers Date: Sun, 24 May 2009 00:03:47 +0100 Subject: [PATCH] allow querying on dm_upload_allowed Signed-off-by: Mark Hymers --- daklib/dbconn.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 537f822d..b3811a1a 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -777,13 +777,17 @@ class DBSource(object): __all__.append('DBSource') -def get_sources_from_name(source, session=None): +def get_sources_from_name(source, dm_upload_allowed=None, session=None): """ Returns list of DBSource objects for given C{source} name @type source: str @param source: DBSource package name to search for + @type dm_upload_allowed: bool + @param dm_upload_allowed: If None, no effect. If True or False, only + return packages with that dm_upload_allowed setting + @type session: Session @param session: Optional SQL session object (a temporary one will be generated if not supplied) @@ -793,7 +797,12 @@ def get_sources_from_name(source, session=None): """ if session is None: session = DBConn().session() - return session.query(DBSource).filter_by(source=source).all() + + q = session.query(DBSource).filter_by(source=source) + if dm_upload_allowed is not None: + q = q.filter_by(dm_upload_allowed=dm_upload_allowed) + + return q.all() __all__.append('get_sources_from_name') -- 2.39.5