From: Torsten Werner Date: Sat, 22 Jan 2011 10:51:29 +0000 (+0100) Subject: Refactor add_dsc_to_db(). X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=a439bac8a6e9b89aab790751f44159d1f546c0bd;p=dak.git Refactor add_dsc_to_db(). Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 6f598bb5..611b30a0 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2268,12 +2268,9 @@ def add_dsc_to_db(u, filename, session=None): session.add(source) session.flush() - for suite_name in u.pkg.changes["distribution"].keys(): - sa = SrcAssociation() - sa.source_id = source.source_id - sa.suite_id = get_suite(suite_name).suite_id - session.add(sa) - + suite_names = u.pkg.changes["distribution"].keys() + source.suites = session.query(Suite). \ + filter(Suite.suite_name.in_(suite_names)).all() session.flush() # Add the source files to the DB (files and dsc_files)