]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/dbconn.py
Convert class OverrideType to ORMObject.
[dak.git] / daklib / dbconn.py
index dc5518a9a698363b5e7411bd1fd1bc4e001f554e..73b1b48d0ae770d96075744c9192f8051acbf2bf 100755 (executable)
@@ -467,7 +467,11 @@ __all__.append('get_archive')
 ################################################################################
 
 class BinContents(ORMObject):
-    def properties(silf):
+    def __init__(self, file = None, binary = None):
+        self.file = file
+        self.binary = binary
+
+    def properties(self):
         return ['file', 'binary']
 
 __all__.append('BinContents')
@@ -1869,12 +1873,15 @@ __all__.append('get_override')
 
 ################################################################################
 
-class OverrideType(object):
-    def __init__(self, *args, **kwargs):
-        pass
+class OverrideType(ORMObject):
+    def __init__(self, overridetype = None):
+        self.overridetype = overridetype
 
-    def __repr__(self):
-        return '<OverrideType %s>' % self.overridetype
+    def properties(self):
+        return ['overridetype', 'overridetype_id']
+
+    def not_null_constraints(self):
+        return ['overridetype']
 
 __all__.append('OverrideType')
 
@@ -2872,7 +2879,9 @@ class DBConn(object):
             'binary_acl',
             'binary_acl_map',
             'build_queue',
+            'build_queue_files',
             'changelogs_text',
+            'changes',
             'component',
             'config',
             'changes_pending_binaries',
@@ -2899,11 +2908,6 @@ class DBConn(object):
             'suite',
             'uid',
             'upload_blocks',
-            # The following tables have primary keys but sqlalchemy
-            # version 0.5 fails to reflect them correctly with database
-            # versions before upgrade #41.
-            #'changes',
-            #'build_queue_files',
         )
 
         tables_no_primary = (
@@ -2916,9 +2920,6 @@ class DBConn(object):
             'suite_src_formats',
             'suite_build_queue_copy',
             'udeb_contents',
-            # see the comment above
-            'changes',
-            'build_queue_files',
         )
 
         views = (
@@ -3167,7 +3168,8 @@ class DBConn(object):
                                  section_id = self.tbl_override.c.section,
                                  section = relation(Section),
                                  overridetype_id = self.tbl_override.c.type,
-                                 overridetype = relation(OverrideType)))
+                                 overridetype = relation(OverrideType, \
+                                    backref=backref('overrides', lazy='dynamic'))))
 
         mapper(OverrideType, self.tbl_override_type,
                properties = dict(overridetype = self.tbl_override_type.c.type,