]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/dbconn.py
Work with newer SQLAlchemy versions
[dak.git] / daklib / dbconn.py
index c792ff5a7e48e18f78cb00d1bc93863aca24855a..3d3561f59618b3c03154a31826f8e9d02ad0d7eb 100755 (executable)
@@ -109,11 +109,11 @@ class DebVersion(UserDefinedType):
         return None
 
 sa_major_version = sqlalchemy.__version__[0:3]
-if sa_major_version in ["0.5", "0.6", "0.7", "0.8", "0.9"]:
+if sa_major_version in ["0.5", "0.6", "0.7", "0.8", "0.9", "1.0"]:
     from sqlalchemy.databases import postgres
     postgres.ischema_names['debversion'] = DebVersion
 else:
-    raise Exception("dak only ported to SQLA versions 0.5 to 0.9 (%s installed).  See daklib/dbconn.py" % sa_major_version)
+    raise Exception("dak only ported to SQLA versions 0.5 to 1.0 (%s installed).  See daklib/dbconn.py" % sa_major_version)
 
 ################################################################################
 
@@ -2158,7 +2158,8 @@ class BinaryMetadata(ORMObject):
     def __init__(self, key = None, value = None, binary = None):
         self.key = key
         self.value = value
-        self.binary = binary
+        if binary is not None:
+            self.binary = binary
 
     def properties(self):
         return ['binary', 'key', 'value']
@@ -2174,7 +2175,8 @@ class SourceMetadata(ORMObject):
     def __init__(self, key = None, value = None, source = None):
         self.key = key
         self.value = value
-        self.source = source
+        if source is not None:
+            self.source = source
 
     def properties(self):
         return ['source', 'key', 'value']