X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=5f24aa73895dc52664e2200cddf06f6a229d5fce;hb=95b7c12bcfbed05d09ce3e0b8fb2c8d8a2c10c96;hp=45e000d395fbf104a8331004e7a95451114ba1f6;hpb=df610ec6b921b869c4e4a25629a0aff3f13a03ae;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 45e000d3..5f24aa73 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -66,10 +66,10 @@ class DebVersion(sqltypes.Text): sa_major_version = sqlalchemy.__version__[0:3] if sa_major_version == "0.5": - from sqlalchemy.databases import postgres - postgres.ischema_names['debversion'] = DebVersion + from sqlalchemy.databases import postgres + postgres.ischema_names['debversion'] = DebVersion else: - raise Exception("dak isn't ported to SQLA versions != 0.5 yet. See daklib/dbconn.py") + raise Exception("dak isn't ported to SQLA versions != 0.5 yet. See daklib/dbconn.py") ################################################################################ @@ -286,12 +286,12 @@ def get_suites_binary_in(package, session=None): __all__.append('get_suites_binary_in') @session_wrapper -def get_binary_from_id(id, session=None): +def get_binary_from_id(binary_id, session=None): """ Returns DBBinary object for given C{id} - @type id: int - @param id: Id of the required binary + @type binary_id: int + @param binary_id: Id of the required binary @type session: Session @param session: Optional SQLA session object (a temporary one will be @@ -301,7 +301,7 @@ def get_binary_from_id(id, session=None): @return: DBBinary object for the given binary (None if not present) """ - q = session.query(DBBinary).filter_by(binary_id=id) + q = session.query(DBBinary).filter_by(binary_id=binary_id) try: return q.one() @@ -769,7 +769,7 @@ def check_poolfile(filename, filesize, md5sum, location_id, session=None): ret = (False, None) else: obj = q.one() - if obj.md5sum != md5sum or obj.filesize != filesize: + if obj.md5sum != md5sum or obj.filesize != int(filesize): ret = (False, obj) if ret is None: @@ -944,8 +944,8 @@ class Keyring(object): def __repr__(self): return '' % self.keyring_name - def de_escape_gpg_str(self, str): - esclist = re.split(r'(\\x..)', str) + def de_escape_gpg_str(self, txt): + esclist = re.split(r'(\\x..)', txt) for x in range(1,len(esclist),2): esclist[x] = "%c" % (int(esclist[x][2:],16)) return "".join(esclist) @@ -1444,13 +1444,13 @@ def insert_pending_content_paths(package, fullpaths, session=None): # Insert paths pathcache = {} for fullpath in fullpaths: - (path, file) = os.path.split(fullpath) + (path, filename) = os.path.split(fullpath) if path.startswith( "./" ): path = path[2:] filepath_id = get_or_set_contents_path_id(path, session) - filename_id = get_or_set_contents_file_id(file, session) + filename_id = get_or_set_contents_file_id(filename, session) pathcache[fullpath] = (filepath_id, filename_id) @@ -2552,7 +2552,8 @@ class DBConn(Singleton): primaryjoin=(self.tbl_src_uploaders.c.maintainer==self.tbl_maintainer.c.id)))) mapper(Suite, self.tbl_suite, - properties = dict(suite_id = self.tbl_suite.c.id)) + properties = dict(suite_id = self.tbl_suite.c.id, + policy_queue = relation(Queue))) mapper(SuiteArchitecture, self.tbl_suite_architectures, properties = dict(suite_id = self.tbl_suite_architectures.c.suite,