#NEWLINE# def sanitize_separators( value ) : #NEWLINE# #INDENT# '\n    Sanitizes a value according to the current decimal and\n    thousand separator setting. Used with form field input.\n    ' #NEWLINE# if settings . USE_L10N : #NEWLINE# #INDENT# decimal_separator = get_format ( 'DECIMAL_SEPARATOR' ) #NEWLINE# if isinstance ( value , six . string_types ) : #NEWLINE# #INDENT# parts = [ ] #NEWLINE# if ( decimal_separator in value ) : #NEWLINE# #INDENT# ( value , decimals ) = value . split ( decimal_separator , 1 ) #NEWLINE# parts . append ( decimals ) #NEWLINE# #UNINDENT# if settings . USE_THOUSAND_SEPARATOR : #NEWLINE# #INDENT# parts . append ( value . replace ( get_format ( 'THOUSAND_SEPARATOR' ) , '' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# parts . append ( value ) #NEWLINE# #UNINDENT# value = '.' . join ( reversed ( parts ) ) #NEWLINE# #UNINDENT# #UNINDENT# return value