#NEWLINE# def convert_values( self , value , field ) : #NEWLINE# #INDENT# "\n        Coerce the value returned by the database backend into a consistent\n        type that is compatible with the field type.\n\n        In our case, cater for the fact that SQL Server < 2008 has no\n        separate Date and Time data types.\n        TODO: See how we'll handle this for SQL Server >= 2008\n        " #NEWLINE# if ( value is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( field and ( field . get_internal_type ( ) == 'DateTimeField' ) ) : #NEWLINE# #INDENT# return value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( field and ( field . get_internal_type ( ) == 'DateField' ) ) : #NEWLINE# #INDENT# value = value . date ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( field and ( field . get_internal_type ( ) == 'TimeField' ) ) or ( isinstance ( field , datetime . datetime ) and ( value . year == 1900 ) and ( value . month == value . day == 1 ) ) ) : #NEWLINE# #INDENT# value = value . time ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( value , datetime . datetime ) and ( value . hour == value . minute == value . second == value . microsecond == 0 ) ) : #NEWLINE# #INDENT# value = value . date ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( value is not None ) and field and ( field . get_internal_type ( ) == 'FloatField' ) ) : #NEWLINE# #INDENT# value = float ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return value