#97 Date Column with DateConverter validator doesn't work

closed-invalid
nobody
None
5
2011-09-24
2010-03-01
Anonymous
No

Hi All,

In saormprovider.py (from sprox-0.6.7-py2.5.egg) line 384 there is a type test

not isinstance(value,datetime)

Having a Column who's type is Date() and value who's validator is DateConverter will cause this predicate to be True which drops us down into the next line's datetime.strptime call which in this case will raise an exception since value is NOT a string. Rather is is a datetime.date. The exception raised is:

TypeError: strptime() argument 1 must be string, not datetime.date

value, being a datetime.date, causes isinstance to return False since its not a datetime object. It is a method_descriptor.

The code doesn't account for a Date column being validated by the DateConverter validator.

The work around is to use DateValidator. But that only works after adding a date_format arg to the validator so that the string will match the format in the datetime.strptime call of saormprovider.py (line 385).

It'd be cool if a Date column could be validated using the DateConverter validator.

Discussion

    • status: open --> closed-invalid