[SQL-CVS] r437 - home/phd/SQLObject/inheritance/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2004-12-03 14:43:54
|
Author: phd Date: 2004-12-03 14:43:51 +0000 (Fri, 03 Dec 2004) New Revision: 437 Modified: home/phd/SQLObject/inheritance/sqlobject/main.py Log: Test _SO_columnDict in addition to __class__. Modified: home/phd/SQLObject/inheritance/sqlobject/main.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-03 14:35:24 UTC (rev 436) +++ home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-03 14:43:51 UTC (rev 437) @@ -904,9 +904,12 @@ value = toPython(dbValue, self._SO_validatorState) setattr(self, instanceName(name), value) for name, value in extra.items(): - if name not in self._SO_columnDict: - raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self.__class__.__name__, name) try: + getattr(self.__class__, name) + except AttributeError: + if name not in self._SO_columnDict: + raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self.__class__.__name__, name) + try: setattr(self, name, value) except AttributeError, e: raise AttributeError, '%s (with attribute %r)' % (e, name) @@ -940,9 +943,12 @@ setattr(self, instanceName(name), value) toUpdate[name] = dbValue for name, value in extra.items(): - if name not in self._SO_columnDict: - raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self.__class__.__name__, name) try: + getattr(self.__class__, name) + except AttributeError: + if name not in self._SO_columnDict: + raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self.__class__.__name__, name) + try: setattr(self, name, value) except AttributeError, e: raise AttributeError, '%s (with attribute %r)' % (e, name) |