#NEWLINE# def _rowfactory( row , cursor ) : #NEWLINE# #INDENT# casted = [ ] #NEWLINE# for ( value , desc ) in zip ( row , cursor . description ) : #NEWLINE# #INDENT# if ( ( value is not None ) and ( desc [ 1 ] is Database . NUMBER ) ) : #NEWLINE# #INDENT# ( precision , scale ) = cursor [ 4 : 6 ] #NEWLINE# if ( scale == ( - 127 ) ) : #NEWLINE# #INDENT# if ( precision == 0 ) : #NEWLINE# #INDENT# if ( '.' in value ) : #NEWLINE# #INDENT# value = decimal . Decimal ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# value = float ( value ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( precision > 0 ) : #NEWLINE# #INDENT# if ( scale == 0 ) : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = decimal . Decimal ( value ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( '.' in value ) : #NEWLINE# #INDENT# value = decimal . Decimal ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( desc [ 1 ] in ( Database . TIMESTAMP , Database . DATETIME ) ) : #NEWLINE# #INDENT# if ( settings . USE_TZ and ( value is not None ) and timezone . is_naive ( value ) ) : #NEWLINE# #INDENT# value = value . replace ( tzinfo = timezone . utc ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( desc [ 1 ] in ( Database . STRING , Database . FIXED_CHAR , Database . LONG_STRING ) ) : #NEWLINE# #INDENT# value = to_unicode ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# casted . append ( value ) #NEWLINE# #UNINDENT# return tuple ( casted )