def field(name, type=STRING, **kwargs):
 (default, index, optional) = (kwargs.get('default', (((type == DATE) and NOW) or None)), kwargs.get('index', False), kwargs.get('optional', True))
 if (type == STRING):
  type = STRING()
 if (type == FLOAT):
  type = 'real'
 if (type == BOOLEAN):
  type = 'tinyint(1)'
 if (type == DATE):
  type = 'timestamp'
 if (str(index) in '01'):
  index = bool(int(index))
 if (str(optional) in '01'):
  optional = bool(int(optional))
 return (name, type, default, index, optional)

def field ( name , type = STRING , ** kwargs ) : ( default , index , optional ) = ( kwargs . get ( 'default' , ( ( ( type == DATE ) and NOW ) or None ) ) , kwargs . get ( 'index' , False ) , kwargs . get ( 'optional' , True ) ) if ( type == STRING ) : type = STRING ( ) if ( type == FLOAT ) : type = 'real' if ( type == BOOLEAN ) : type = 'tinyint(1)' if ( type == DATE ) : type = 'timestamp' if ( str ( index ) in '01' ) : index = bool ( int ( index ) ) if ( str ( optional ) in '01' ) : optional = bool ( int ( optional ) ) return ( name , type , default , index , optional )
returns a table field definition that can be passed to database .