From e6d57b8d52035f9ec7f0efcd9cca2c1514c7d055 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Tue, 18 Jan 2011 06:51:38 +0100 Subject: [PATCH] Make relation Maintainer - DBSource bidirectional. The following is possible now (returns lists of DBSource objects): - somesrc.maintainer.maintains_sources - somesrc.changedby.changed_sources Signed-off-by: Torsten Werner --- daklib/dbconn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index bfce1f2c..6ea3aa39 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -3020,7 +3020,11 @@ class DBConn(object): archive_type = self.tbl_location.c.type)) mapper(Maintainer, self.tbl_maintainer, - properties = dict(maintainer_id = self.tbl_maintainer.c.id)) + properties = dict(maintainer_id = self.tbl_maintainer.c.id, + maintains_sources = relation(DBSource, backref='maintainer', + primaryjoin=(self.tbl_maintainer.c.id==self.tbl_source.c.maintainer)), + changed_sources = relation(DBSource, backref='changedby', + primaryjoin=(self.tbl_maintainer.c.id==self.tbl_source.c.changedby)))) mapper(NewComment, self.tbl_new_comments, properties = dict(comment_id = self.tbl_new_comments.c.id)) @@ -3056,15 +3060,11 @@ class DBConn(object): properties = dict(source_id = self.tbl_source.c.id, version = self.tbl_source.c.version, maintainer_id = self.tbl_source.c.maintainer, - maintainer = relation(Maintainer, - primaryjoin=(self.tbl_source.c.maintainer==self.tbl_maintainer.c.id)), poolfile_id = self.tbl_source.c.file, poolfile = relation(PoolFile), fingerprint_id = self.tbl_source.c.sig_fpr, fingerprint = relation(Fingerprint), changedby_id = self.tbl_source.c.changedby, - changedby = relation(Maintainer, - primaryjoin=(self.tbl_source.c.changedby==self.tbl_maintainer.c.id)), srcfiles = relation(DSCFile, primaryjoin=(self.tbl_source.c.id==self.tbl_dsc_files.c.source)), suites = relation(Suite, secondary=self.tbl_src_associations, -- 2.39.5