X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=daklib%2Fdbconn.py;h=1ac0c4b5de02992a83819ef8e02999369582d701;hb=227db2f1b21c06ec076c88f79850daf0f154b900;hp=47b933e43728bafe73850a4922ab429cc8a0cc92;hpb=1549379cef7c649ab3b65f7b44baaddef9339c08;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 47b933e4..1ac0c4b5 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -911,8 +911,8 @@ class Component(ORMObject): return NotImplemented def properties(self): - return ['component_name', 'component_id', 'description', 'location', \ - 'meets_dfsg'] + return ['component_name', 'component_id', 'description', \ + 'location_count', 'meets_dfsg', 'overrides_count'] def not_null_constraints(self): return ['component_name'] @@ -2078,9 +2078,16 @@ __all__.append('get_policy_queue_from_path') ################################################################################ -class Priority(object): - def __init__(self, *args, **kwargs): - pass +class Priority(ORMObject): + def __init__(self, priority = None, level = None): + self.priority = priority + self.level = level + + def properties(self): + return ['priority', 'priority_id', 'level', 'overrides_count'] + + def not_null_constraints(self): + return ['priority', 'level'] def __eq__(self, val): if isinstance(val, str): @@ -2094,9 +2101,6 @@ class Priority(object): # This signals to use the normal comparison operator return NotImplemented - def __repr__(self): - return '' % (self.priority, self.priority_id) - __all__.append('Priority') @session_wrapper @@ -3140,8 +3144,7 @@ class DBConn(object): mapper(Location, self.tbl_location, properties = dict(location_id = self.tbl_location.c.id, component_id = self.tbl_location.c.component, - component = relation(Component, \ - backref=backref('location', uselist = False)), + component = relation(Component, backref='location'), archive_id = self.tbl_location.c.archive, archive = relation(Archive), # FIXME: the 'type' column is old cruft and @@ -3165,9 +3168,11 @@ class DBConn(object): suite = relation(Suite), package = self.tbl_override.c.package, component_id = self.tbl_override.c.component, - component = relation(Component), + component = relation(Component, \ + backref=backref('overrides', lazy='dynamic')), priority_id = self.tbl_override.c.priority, - priority = relation(Priority), + priority = relation(Priority, \ + backref=backref('overrides', lazy='dynamic')), section_id = self.tbl_override.c.section, section = relation(Section, \ backref=backref('overrides', lazy='dynamic')),