]> err.no Git - dak/commitdiff
tidy up and add more methods to SQLA objects
authorMark Hymers <mhy@debian.org>
Wed, 28 Oct 2009 16:18:22 +0000 (16:18 +0000)
committerMark Hymers <mhy@debian.org>
Wed, 28 Oct 2009 16:18:22 +0000 (16:18 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/dakdb/update16.py
daklib/dbconn.py

index 7c94568274d0979f36c2be28e405e9e939c4e2f7..c52ceee3e261acb65894fc6a8f2466a56856c6d6 100755 (executable)
@@ -100,10 +100,10 @@ def do_update(self):
 
         ## NULL means no source upload access (i.e. any upload containing source
         ## will be rejected)
-        c.execute("ALTER TABLE fingerprint ADD COLUMN source_acl INT4 REFERENCES source_acl(id) DEFAULT NULL")
+        c.execute("ALTER TABLE fingerprint ADD COLUMN source_acl_id INT4 REFERENCES source_acl(id) DEFAULT NULL")
 
         ## NULL means no binary upload access
-        c.execute("ALTER TABLE fingerprint ADD COLUMN binary_acl INT4 REFERENCES binary_acl(id) DEFAULT NULL")
+        c.execute("ALTER TABLE fingerprint ADD COLUMN binary_acl_id INT4 REFERENCES binary_acl(id) DEFAULT NULL")
 
         # Blockage table (replaces the hard coded stuff we used to have in extensions)
         print "Adding blockage table"
index e9ae60e50b19b50b5cc59afc3b2d100e4bb572a5..c590db430d1e1b9d1813907eb1f19a602f049c5b 100755 (executable)
@@ -381,6 +381,9 @@ class BinaryACL(object):
     def __init__(self, *args, **kwargs):
         pass
 
+    def __repr__(self):
+        return '<BinaryACL %s>' % self.binary_acl_id
+
 __all__.append('BinaryACL')
 
 ################################################################################
@@ -389,6 +392,9 @@ class BinaryACLMap(object):
     def __init__(self, *args, **kwargs):
         pass
 
+    def __repr__(self):
+        return '<BinaryACLMap %s>' % self.binary_acl_map_id
+
 __all__.append('BinaryACLMap')
 
 ################################################################################
@@ -1790,6 +1796,9 @@ class SourceACL(object):
     def __init__(self, *args, **kwargs):
         pass
 
+    def __repr__(self):
+        return '<SourceACL %s>' % self.source_acl_id
+
 __all__.append('SourceACL')
 
 ################################################################################
@@ -2117,6 +2126,9 @@ class UploadBlock(object):
     def __init__(self, *args, **kwargs):
         pass
 
+    def __repr__(self):
+        return '<UploadBlock %s (%s)>' % (self.source, self.upload_block_id)
+
 __all__.append('UploadBlock')
 
 ################################################################################
@@ -2209,7 +2221,9 @@ class DBConn(Singleton):
                properties = dict(binary_acl_id = self.tbl_binary_acl.c.id))
 
         mapper(BinaryACLMap, self.tbl_binary_acl_map,
-               properties = dict(binary_acl_map_id = self.tbl_binary_acl_map.c.id))
+               properties = dict(binary_acl_map_id = self.tbl_binary_acl_map.c.id,
+                                 fingerprint = relation(Fingerprint, backref="binary_acl_map"),
+                                 architecture = relation(Architecture)))
 
         mapper(Component, self.tbl_component,
                properties = dict(component_id = self.tbl_component.c.id,
@@ -2254,7 +2268,9 @@ class DBConn(Singleton):
                                  uid_id = self.tbl_fingerprint.c.uid,
                                  uid = relation(Uid),
                                  keyring_id = self.tbl_fingerprint.c.keyring,
-                                 keyring = relation(Keyring)))
+                                 keyring = relation(Keyring),
+                                 source_acl = relation(SourceACL),
+                                 binary_acl = relation(BinaryACL)))
 
         mapper(Keyring, self.tbl_keyrings,
                properties = dict(keyring_name = self.tbl_keyrings.c.name,
@@ -2372,7 +2388,9 @@ class DBConn(Singleton):
                                  fingerprint = relation(Fingerprint)))
 
         mapper(UploadBlock, self.tbl_upload_blocks,
-               properties = dict(upload_block_id = self.tbl_upload_blocks.c.id))
+               properties = dict(upload_block_id = self.tbl_upload_blocks.c.id,
+                                 fingerprint = relation(Fingerprint, backref="uploadblocks"),
+                                 uid = relation(Uid, backref="uploadblocks")))
 
     ## Connection functions
     def __createconn(self):