X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=daklib%2Fdbconn.py;h=fa52a9187bbc080caeaaa43919033b0435021b41;hb=adbb859e09d90791b4543f5c4fc5ecf589c9a1a7;hp=5e047847e0b3d36054b174461228371bd08c48c9;hpb=d31bb7a50540b7e6bc86a13a14cd88cd9899395d;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 5e047847..fa52a918 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -262,6 +262,12 @@ class ORMObject(object): validation fails. ''' for property in self.not_null_constraints(): + # TODO: It is a bit awkward that the mapper configuration allow + # directly setting the numeric _id columns. We should get rid of it + # in the long run. + if hasattr(self, property + '_id') and \ + getattr(self, property + '_id') is not None: + continue if not hasattr(self, property) or getattr(self, property) is None: raise DBUpdateError(self.validation_message % \ (property, str(self))) @@ -2239,8 +2245,8 @@ class DBSource(ORMObject): 'install_date'] def not_null_constraints(self): - return ['source', 'version', 'maintainer', 'changedby', \ - 'poolfile', 'install_date'] + return ['source', 'version', 'install_date', 'maintainer', \ + 'changedby', 'poolfile', 'install_date'] __all__.append('DBSource')