#NEWLINE# def validate( self , value ) : #NEWLINE# #INDENT# from decimal import Decimal as _Decimal #NEWLINE# from decimal import InvalidOperation #NEWLINE# val = super ( Decimal , self ) . validate ( value ) #NEWLINE# if ( val is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return ( _Decimal ( repr ( value ) ) if isinstance ( val , float ) else _Decimal ( val ) ) #NEWLINE# #UNINDENT# except InvalidOperation : #NEWLINE# #INDENT# raise ValidationError ( "{0} '{1}' can't be coerced to decimal" . format ( self . column_name , val ) )