[SQLObject] .set() fromPython toPython
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2004-12-03 06:51:25
|
Hello! ._SO_setValue() converts the passed value fromPython to dbValue, and then dbValue toPython. This allows me to make things like that: person.birthTime = MyDateTime(1967, 12, 21) (where .birthTime is a db column with a getter, a setter, a validator that converts MyDateTime from/to python to/from string and store that string in the db) person.birthTime = "19671221" (now ._SO_setValue() will call fromPython which converts the string to the same string, and toPython which converts the string to MyDateTime instance) All of this is pretty good, convenient and useful. Unfortunately, .set() doesn't convert values back toPython. person.set(birthTime = "19671221") (Ouch! now .birthTime contains the string instead of MyDateTime instance) I think .set() has to convert values back toPython. I'd like to fix it, if noone obects. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |