Ticket #5355: 5355.diff
File 5355.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/newforms/fields.py
192 192 super(DecimalField, self).clean(value) 193 193 if not self.required and value in EMPTY_VALUES: 194 194 return None 195 value = value.strip()196 195 try: 197 196 value = Decimal(value) 198 197 except DecimalException: -
tests/regressiontests/forms/tests.py
961 961 Traceback (most recent call last): 962 962 ... 963 963 ValidationError: [u'Enter a whole number.'] 964 >>> f.clean(42) 965 42 966 >>> f.clean(3.14) 967 3 964 968 >>> f.clean('1 ') 965 969 1 966 970 >>> f.clean(' 1') … … 1084 1088 23.0 1085 1089 >>> f.clean('3.14') 1086 1090 3.1400000000000001 1091 >>> f.clean(3.14) 1092 3.1400000000000001 1093 >>> f.clean(42) 1094 42.0 1087 1095 >>> f.clean('a') 1088 1096 Traceback (most recent call last): 1089 1097 ... … … 1142 1150 Decimal("23") 1143 1151 >>> f.clean('3.14') 1144 1152 Decimal("3.14") 1153 >>> f.clean(3.14) 1154 Decimal("3.14") 1155 >>> f.clean(Decimal('3.14')) 1156 Decimal("3.14") 1145 1157 >>> f.clean('a') 1146 1158 Traceback (most recent call last): 1147 1159 ...