From: Ian B. <ia...@co...> - 2003-09-26 07:13:57
|
On Thursday, September 25, 2003, at 05:03 PM, Sidnei da Silva wrote: > I've just checked in a BoolCol, and later I've figured out that it > only works reliably on python 2.3. When I run the tests on python 2.2 > I get 16 errors on my box, but none on 2.3. Can anyone confirm which > one is the target version? They both are supported. 2.2 is the "gold" Python release, i.e., the new lowest common denominator. Of course, 2.3 is the "best" Python release, i.e., if you can you should use it. In this case the issue was that type(True) == int for 2.2, but not for 2.3. That's easy enough to fix -- basically you don't need BoolConverter in 2.2, so you don't install it in that case. BoolCol has to be a bit more sophisticated than using a converter. I've added a validator that will do the trick. Unfortunately this has raised a new problem. Booleans are represented differently depending on what database you are using. The obvious choice for booleans in MySQL is TINYINT. In Postgres BOOLEAN. MySQL thus likes 0 and 1. Postgres likes 't' and 'f' or other things, but not integers. Annoying. Okay, we could make boolean columns into ENUM('t', 'f') in MySQL, but I'm afraid that's dumb. Though not actually any less efficient, probably. I don't know. But really I need to bite the bullet and put in database compatibility code into SQLBuilder and Converters. I've committed some changes to Converters and Col that fix this, and a number of other fixes to validation in general. For now MySQL does BoolCol with the ENUM. Ian |