From: Torsten Werner Date: Tue, 25 Jan 2011 18:54:14 +0000 (+0100) Subject: Change base class of Uid to ORMObject. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e1fab57c0ef76f5ce25c0480a9bb056cf25ebc3;p=dak Change base class of Uid to ORMObject. Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 837ce8e4..020040c9 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -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 '' % (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, diff --git a/tests/dbtest_fingerprint.py b/tests/dbtest_fingerprint.py index 72e081a8..8d57ea0f 100755 --- a/tests/dbtest_fingerprint.py +++ b/tests/dbtest_fingerprint.py @@ -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()