From bddca9de18cba8527f703112a171f13f01ab9f90 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Sat, 12 Feb 2011 22:31:42 +0100 Subject: [PATCH] Improve class Suite. Signed-off-by: Torsten Werner --- daklib/dbconn.py | 6 ++++-- tests/dbtest_packages.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 1ac0c4b5..d430124a 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2616,7 +2616,8 @@ class Suite(ORMObject): self.version = version def properties(self): - return ['suite_name', 'version', 'sources_count', 'binaries_count'] + return ['suite_name', 'version', 'sources_count', 'binaries_count', \ + 'overrides_count'] def not_null_constraints(self): return ['suite_name', 'version'] @@ -3165,7 +3166,8 @@ class DBConn(object): mapper(Override, self.tbl_override, properties = dict(suite_id = self.tbl_override.c.suite, - suite = relation(Suite), + suite = relation(Suite, \ + backref=backref('overrides', lazy='dynamic')), package = self.tbl_override.c.package, component_id = self.tbl_override.c.component, component = relation(Component, \ diff --git a/tests/dbtest_packages.py b/tests/dbtest_packages.py index 8c004cd6..32c1b8c5 100755 --- a/tests/dbtest_packages.py +++ b/tests/dbtest_packages.py @@ -66,6 +66,8 @@ class PackageTestCase(DBDakTestCase): suites = get_architecture_suites('kfreebsd-i386', self.session) self.assertEqual(2, len(suites)) self.assertTrue(self.suite['lenny'] not in suites) + # check overrides + self.assertEqual(0, self.suite['lenny'].overrides.count()) def test_poolfiles(self): ''' -- 2.39.5