On Tue, Aug 11, 2009 at 04:53:12PM -0700, Ray Van Dolson wrote:
> It seems like this worked in the past, but I could just be imagining
> things :)
Yes, long ago all column types accepted strings and passed them to the
backend as is. Later it was decided to make conversion stricter.
> I could write a simple function to check whether or not I'm on a column
> in my CSV file that has a date/time value, generate a datetime object
> from it and pass it along as the value for updating.
I'd very much recommend that way. With this you can check that the
values are really date/time values in your preferred format.
> The other option (and what I ended up doing for now) is to modify the
> DateTimeValidator
You don't need to modify the builtin validator. You can create your own
column type (inherited from DateTimeCol) with your own validator (inherited
from DateTimeValidator). Or you can pass a validator to the column, and
your validator will be stacked on top of the DateTimeValidator. See
examples at
http://svn.colorstudy.com/SQLObject/trunk/sqlobject/tests/test_validation.py
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|