title: Problem writing bool converter in ponyorm
body: <p>My database stores bool values as CHAR(1), T=True, F=False.  I'm trying to write a converter so that I can use bool values in my python code and have pony handle the conversion to the database. </p>
  
  <p>Here's what I have:</p>
  
  <pre><code>from pony import orm
  from pony.orm.dbapiprovider import BoolConverter
  
  class DALBoolConverter(BoolConverter):
      def validate(self, val, obj=None):
          print 'VALIDATOR', val, obj
          return val
  
      def py2sql(self, val):
          print 'py2sql', val
          return 'T' if val else 'F'
  
      def sql2py(self, val):
          print 'sql2py', val
          return True if val == 'T' else False
  
      def sql_type(self):
          print 'sql_type'
          return 'CHAR(1)'
  
  db.provider.converter_classes.append((bool, DALBoolConverter))
  
  class AuthUser(db.Entity):
      _table_ = 'auth_user'
  
      first_name = orm.Required(str)
      last_name = orm.Required(str)
      email = orm.Optional(str)
      password = orm.Optional(str)
      registration_key = orm.Optional(str)
      reset_password_key = orm.Optional(str)
      registration_id = orm.Optional(str)
      active = orm.Required(bool)
  
  if __name__ == '__main__':
      with db_session:
          a = AuthUser[1]
          print a.active  #  returns True
          a.active = False
  </code></pre>
  
  <p>You can see I have some print statements in there but they are never executed.  I'm getting the following traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/jim/dev/qlf/qlf/pony_model.py", line 720, in &lt;module&gt;
      """
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 476, in __exit__
      db_session._commit_or_rollback(exc_type, exc, tb)
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 490, in _commit_or_rollback
      commit()
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 381, in commit
      rollback_and_reraise(sys.exc_info())
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 370, in rollback_and_reraise
      reraise(*exc_info)
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 379, in commit
      cache.flush()
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 1888, in flush
      if obj is not None: obj._save_()
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 5363, in _save_
      elif status == 'modified': obj._save_updated_()
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 5272, in _save_updated_
      cursor = database._exec_sql(sql, arguments, start_transaction=True)
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 945, in _exec_sql
      connection = cache.reconnect(e)
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 1776, in reconnect
      if not provider.should_reconnect(exc): reraise(*sys.exc_info())
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/core.py", line 943, in _exec_sql
      try: new_id = provider.execute(cursor, sql, arguments, returning_id)
    File "&lt;auto generated wrapper of execute() function&gt;", line 2, in execute
    File "/home/jim/.local/lib/python2.7/site-packages/pony/orm/dbapiprovider.py", line 61, in wrap_dbapi_exceptions
      raise OperationalError(e)
  pony.orm.dbapiprovider.OperationalError: (1292, "Truncated incorrect DOUBLE value: 'T  '")
  </code></pre>
  
  <p>...which probably makes sense because I don't think my DALBoolConverter is ever getting called.</p>
  
  <p>Any pointers?</p>