]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/dbconn.py
Improve relation between Suite and Architecture.
[dak.git] / daklib / dbconn.py
index bae2bb355c3cc24869d0c166f027adba4955de43..59fe5dc3c0f6fd5a1ce8c8ca1edda8958b4064cf 100755 (executable)
@@ -78,7 +78,8 @@ class DebVersion(UserDefinedType):
     def bind_processor(self, dialect):
         return None
 
-    def result_processor(self, dialect):
+    # ' = None' is needed for sqlalchemy 0.5:
+    def result_processor(self, dialect, coltype = None):
         return None
 
 sa_major_version = sqlalchemy.__version__[0:3]
@@ -146,8 +147,9 @@ __all__.append('session_wrapper')
 ################################################################################
 
 class Architecture(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, arch_string = None, description = None):
+        self.arch_string = arch_string
+        self.description = description
 
     def __eq__(self, val):
         if isinstance(val, str):
@@ -1225,8 +1227,8 @@ __all__.append('add_poolfile')
 ################################################################################
 
 class Fingerprint(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, fingerprint = None):
+        self.fingerprint = fingerprint
 
     def __repr__(self):
         return '<Fingerprint %s>' % self.fingerprint
@@ -2500,8 +2502,9 @@ SUITE_FIELDS = [ ('SuiteName', 'suite_name'),
                  ('OverrideSuite', 'overridesuite')]
 
 class Suite(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, suite_name = None, version = None):
+        self.suite_name = suite_name
+        self.version = version
 
     def __repr__(self):
         return '<Suite %s>' % self.suite_name
@@ -2675,8 +2678,9 @@ __all__.append('get_suite_src_formats')
 ################################################################################
 
 class Uid(object):
-    def __init__(self, *args, **kwargs):
-        pass
+    def __init__(self, uid = None, name = None):
+        self.uid = uid
+        self.name = name
 
     def __eq__(self, val):
         if isinstance(val, str):
@@ -2870,7 +2874,8 @@ class DBConn(object):
 
     def __setupmappers(self):
         mapper(Architecture, self.tbl_architecture,
-               properties = dict(arch_id = self.tbl_architecture.c.id))
+               properties = dict(arch_id = self.tbl_architecture.c.id,
+                                 suites = relation(Suite, secondary=self.tbl_suite_architectures, backref='architectures')))
 
         mapper(Archive, self.tbl_archive,
                properties = dict(archive_id = self.tbl_archive.c.id,