#NEWLINE# @ staticmethod #NEWLINE# def type_compatible( value , column_type ) : #NEWLINE# #INDENT# 'Check if value type is compatible with the column type.' #NEWLINE# if ( column_type is None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# if ( not hasattr ( column_type , 'python_type' ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# column_python_type = column_type . python_type #NEWLINE# if isinstance ( value , column_python_type ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# if issubclass ( column_python_type , basestring ) : #NEWLINE# #INDENT# return isinstance ( value , basestring ) #NEWLINE# #UNINDENT# if ( column_python_type in [ int , long ] ) : #NEWLINE# #INDENT# return ( type ( value ) in [ int , long ] ) #NEWLINE# #UNINDENT# if ( column_python_type in [ float ] ) : #NEWLINE# #INDENT# return ( type ( value ) in [ float ] ) #NEWLINE# #UNINDENT# if ( column_python_type in [ bool ] ) : #NEWLINE# #INDENT# return ( type ( value ) in [ bool ] ) #NEWLINE# #UNINDENT# return False