]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/dbconn.py
Add an incomplete test for Maintainer.
[dak.git] / daklib / dbconn.py
index 766efdb4a9e463f6b1b3837c3410037d2174a90c..93ec11720379e99549272cae3af94718a2bfacba 100755 (executable)
@@ -1567,8 +1567,8 @@ __all__.append('get_location')
 ################################################################################
 
 class Maintainer(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, name = None):
+        self.name = name
 
     def __repr__(self):
         return '''<Maintainer '%s' (%s)>''' % (self.name, self.maintainer_id)
@@ -2106,8 +2106,9 @@ __all__.append('get_sections')
 ################################################################################
 
 class DBSource(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, maintainer = None, changedby = None):
+        self.maintainer = maintainer
+        self.changedby = changedby
 
     def __repr__(self):
         return '<DBSource %s (%s)>' % (self.source, self.version)
@@ -3020,7 +3021,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,19 +3061,15 @@ 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)),
-                                 srcassociations = relation(SrcAssociation,
-                                                            primaryjoin=(self.tbl_source.c.id==self.tbl_src_associations.c.source)),
+                                 suites = relation(Suite, secondary=self.tbl_src_associations,
+                                     backref='sources'),
                                  srcuploaders = relation(SrcUploader)))
 
         mapper(SourceACL, self.tbl_source_acl,