From: Oleg B. <ph...@ph...> - 2004-11-26 12:03:33
|
Method SQLObject.set(), lines 769-774: if self._SO_creating or self._lazyUpdate: for name, value in kw.items(): fromPy = getattr(self, '_SO_fromPython_%s' % name, None) if fromPy: kw[name] = value = fromPy(value, self._SO_validatorState) setattr(self, instanceName(name), value) Method SQLObject.set(), lines 793-801: for name, value in kw.items(): fromPython = getattr(self, '_SO_fromPython_%s' % name, None) if fromPython: dbValue = fromPython(value, self._SO_validatorState) else: dbValue = value toUpdate[name] = dbValue if self._cacheValues: setattr(self, instanceName(name), value) In the first snippet the value is converted from Python to db value and assigned to the attribute named "name". In te second snippet in is not converted; instead, new variable dbValue holds convertd value, and the attribute "name" receives original, "pythonic" value. Isn't there a bug in the first snippet? Shouldn't it be kw[name] = dbValue = fromPy(value, self._SO_validatorState) setattr(self, instanceName(name), value) ? I am not sure how special _SO_creating is... Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |