Re: [SQLObject] Strange column type conversion
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2005-01-04 16:59:48
|
Stuart Bishop wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Oleg Broytmann wrote: > | On Mon, Jan 03, 2005 at 10:39:29PM +0800, Hong Yaun wrote: > | > |>But anyway, for a column decalred as IntCol, it > |>should always return values as <type int>, and I wish this could be > |>fixed soon, maybe by prohibiting to assign a string value to such a > column. > | > | > | What do other people here think? Should the IntCol accept strings? > | silently call int() on any input? or raise TypeError in case the input > | value is not of type int? > > It should accept anything that has an __sqlrepr__ shouldn't it? Yeah, but that's an open bug too, e.g., the sqlbuilder.func.NOW() issue (where NOW() ends up being the column value, even though it's not a concrete Python value, just an abstract SQL expression). Until that's fixed, it doesn't really help anyone to allow __sqlrepr__-having objects in. Probably the fix would be to detect these objects, and if found call .expire() on the instance, forcing the data to be refetched on the next access. Hmm... maybe that's not too hard. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |