From: Mark Hymers Date: Wed, 28 Oct 2009 16:18:22 +0000 (+0000) Subject: tidy up and add more methods to SQLA objects X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba03c9a5fdcf98f01fe35c8c0916b9c1d02cae59;p=dak tidy up and add more methods to SQLA objects Signed-off-by: Mark Hymers --- diff --git a/dak/dakdb/update16.py b/dak/dakdb/update16.py index 7c945682..c52ceee3 100755 --- a/dak/dakdb/update16.py +++ b/dak/dakdb/update16.py @@ -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" diff --git a/daklib/dbconn.py b/daklib/dbconn.py index e9ae60e5..c590db43 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -381,6 +381,9 @@ class BinaryACL(object): def __init__(self, *args, **kwargs): pass + def __repr__(self): + return '' % self.binary_acl_id + __all__.append('BinaryACL') ################################################################################ @@ -389,6 +392,9 @@ class BinaryACLMap(object): def __init__(self, *args, **kwargs): pass + def __repr__(self): + return '' % 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 '' % self.source_acl_id + __all__.append('SourceACL') ################################################################################ @@ -2117,6 +2126,9 @@ class UploadBlock(object): def __init__(self, *args, **kwargs): pass + def __repr__(self): + return '' % (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):