From: Ansgar Burchardt Date: Sun, 6 May 2012 15:47:15 +0000 (+0200) Subject: Stop passing order_by as a string. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c70083c0df3435e068144a27c9fce94b3b5647a;p=dak Stop passing order_by as a string. This no longer worked with SQLAlchemy 0.7. --- diff --git a/dak/admin.py b/dak/admin.py index e109877f..de324bfd 100755 --- a/dak/admin.py +++ b/dak/admin.py @@ -110,7 +110,7 @@ Perform administrative work on the dak database. ################################################################################ def __architecture_list(d, args): - q = d.session().query(Architecture).order_by('arch_string') + q = d.session().query(Architecture).order_by(Architecture.arch_string) for j in q.all(): # HACK: We should get rid of source from the arch table if j.arch_string == 'source': continue @@ -184,7 +184,7 @@ dispatch['a'] = architecture def __suite_list(d, args): s = d.session() - for j in s.query(Suite).order_by('suite_name').all(): + for j in s.query(Suite).order_by(Suite.suite_name).all(): print j.suite_name def __suite_show(d, args): @@ -236,7 +236,7 @@ def __suite_add(d, args, addallarches=False): if addallarches: arches = [] - q = s.query(Architecture).order_by('arch_string') + q = s.query(Architecture).order_by(Architecture.arch_string) for arch in q.all(): suite.architectures.append(arch) arches.append(arch.arch_string) @@ -273,7 +273,7 @@ dispatch['s'] = suite def __suite_architecture_list(d, args): s = d.session() - for j in s.query(Suite).order_by('suite_name'): + for j in s.query(Suite).order_by(Suite.suite_name): architectures = j.get_architectures(skipsrc = True, skipall = True) print j.suite_name + ': ' + \ ', '.join([a.arch_string for a in architectures]) @@ -375,7 +375,7 @@ dispatch['s-a'] = suite_architecture def __version_check_list(d): session = d.session() - for s in session.query(Suite).order_by('suite_name'): + for s in session.query(Suite).order_by(Suite.suite_name): __version_check_list_suite(d, s.suite_name) def __version_check_list_suite(d, suite_name): diff --git a/daklib/dbconn.py b/daklib/dbconn.py index fd2ea345..c0295e17 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -3357,8 +3357,8 @@ class DBConn(object): mapper(Architecture, self.tbl_architecture, properties = dict(arch_id = self.tbl_architecture.c.id, suites = relation(Suite, secondary=self.tbl_suite_architectures, - order_by='suite_name', - backref=backref('architectures', order_by='arch_string'))), + order_by=self.tbl_suite.c.suite_name, + backref=backref('architectures', order_by=self.tbl_architecture.c.arch_string))), extension = validator) mapper(Archive, self.tbl_archive,