X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=955ca8154bb98440a8af4aa5fcc3a823b48dcba5;hb=1798c52350ce339118397db01f720fb772f63f8a;hp=adf119bc74f8379d05fc11b3d57e794068aa76f1;hpb=f0dfed181878c35f5b7e6d9cb2a733476106f097;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index adf119bc..955ca815 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -434,7 +434,7 @@ class BuildQueue(object): pass def __repr__(self): - return '' % self.queue_name + return '' % self.queue_name def add_file_from_pool(self, poolfile): """Copies a file into the pool. Assumes that the PoolFile object is @@ -2062,6 +2062,11 @@ def add_dsc_to_db(u, filename, session=None): poolfile = add_poolfile(filename, dentry, dsc_location_id, session) pfs.append(poolfile) files_id = poolfile.file_id + else: + poolfile = get_poolfile_by_id(files_id, session) + if poolfile is None: + utils.fubar("INTERNAL ERROR. Found no poolfile with id %d" % files_id) + pfs.append(poolfile) df.poolfile_id = files_id session.add(df) @@ -2565,8 +2570,8 @@ class DBConn(object): ) for table_name in tables: - table = Table('tbl_%s' % table_name, self.db_meta, autoload=True) - setattr(self, table_name, table) + table = Table(table_name, self.db_meta, autoload=True) + setattr(self, 'tbl_%s' % table_name, table) def __setupmappers(self): mapper(Architecture, self.tbl_architecture, @@ -2663,8 +2668,8 @@ class DBConn(object): primaryjoin=(self.tbl_changes.c.in_queue==self.tbl_policy_queue.c.id)), approved_for_id = self.tbl_changes.c.approved_for)) - mapper(ChangePendingBinary, self.tbl_changes_pending_binary, - properties = dict(change_pending_binary_id = self.tbl_changes_pending_binary.c.id)) + mapper(ChangePendingBinary, self.tbl_changes_pending_binaries, + properties = dict(change_pending_binary_id = self.tbl_changes_pending_binaries.c.id)) mapper(ChangePendingFile, self.tbl_changes_pending_files, properties = dict(change_pending_file_id = self.tbl_changes_pending_files.c.id))