]> git.decadent.org.uk Git - dak.git/commitdiff
Change base class of Uid to ORMObject.
authorTorsten Werner <twerner@debian.org>
Tue, 25 Jan 2011 18:54:14 +0000 (19:54 +0100)
committerTorsten Werner <twerner@debian.org>
Tue, 25 Jan 2011 18:54:14 +0000 (19:54 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/dbconn.py
tests/dbtest_fingerprint.py

index 837ce8e47b39dfe270d9a70b0f9a2eeed8395a35..020040c98294e4703950adc3aee45e461e8b2f0e 100755 (executable)
@@ -2802,7 +2802,7 @@ __all__.append('get_suite_src_formats')
 
 ################################################################################
 
-class Uid(object):
+class Uid(ORMObject):
     def __init__(self, uid = None, name = None):
         self.uid = uid
         self.name = name
@@ -2819,8 +2819,11 @@ class Uid(object):
         # This signals to use the normal comparison operator
         return NotImplemented
 
-    def __repr__(self):
-        return '<Uid %s (%s)>' % (self.uid, self.name)
+    def properties(self):
+        return ['uid', 'name', 'fingerprint']
+
+    def not_null_constraints(self):
+        return ['uid']
 
 __all__.append('Uid')
 
@@ -3261,7 +3264,8 @@ class DBConn(object):
 
         mapper(Uid, self.tbl_uid,
                properties = dict(uid_id = self.tbl_uid.c.id,
-                                 fingerprint = relation(Fingerprint)))
+                                 fingerprint = relation(Fingerprint)),
+               extension = validator)
 
         mapper(UploadBlock, self.tbl_upload_blocks,
                properties = dict(upload_block_id = self.tbl_upload_blocks.c.id,
index 72e081a8a06a2591aca301acef51edaa844d520d..8d57ea0f5c7e56e9890be4b3cab5add7b317ff1b 100755 (executable)
@@ -60,7 +60,7 @@ class FingerprintTestCase(DBDakTestCase):
         self.session.rollback()
         self.assertRaises(IntegrityError, self.fingerprint_duplicate_fingerprint)
         self.session.rollback()
-        self.assertRaises(IntegrityError, self.uid_no_uid)
+        self.assertRaises(DBUpdateError, self.uid_no_uid)
         self.session.rollback()
         self.assertRaises(IntegrityError, self.uid_duplicate_uid)
         self.session.rollback()