Hmmm, it translates on its own 1 to True like this:
"SELECT count(*) FROM direccionesgrupo WHERE
direccionesgrupo.activo='T';"
Which results in 58 rows
Whereas if it does
"SELECT count(*) FROM direccionesgrupo WHERE
direccionesgrupo.activo=1;"
Then result is 112
MySQL seems to take anything it doesnt understand as a 0 and returns
all the values = 0. (If instead of 'T' I enter any other char value
still gets the ceroes as if it was retreiving false values).
True or false are like
SELECT count(*) FROM direccionesgrupo WHERE activo=TRUE;
or
SELECT count(*) FROM direccionesgrupo WHERE activo=FALSE;
for MySQL. Which are actually just aliases TRUE for 1, FALSE for 0.
Probably need to change the SELECT generated to 1 or 0, or not change
value from 1 to 'T' on its own.
If instead of ==1 I use ==True, same result (though I guess you are
aware of that).
db(db.direccionesgrupo.activo==True)._select('count(*)')
Out[3]: "SELECT count(*) FROM direccionesgrupo WHERE
direccionesgrupo.activo='T';"