Commits

Anonymous committed 7576508

Numeric field consistency: IntegerField and FloatField on a value of None will display an empty input, like DecimalField.

Comments (0)

Files changed (2)

         self.assertEqual(len(form.b.errors), 1)
         form = self.F(b=9)
         self.assertEqual(form.b.data, 9)
-        self.assertEqual(form.a._value(), "0")
-        self.assertEqual(form.b._value(), "9")
+        self.assertEqual(form.a._value(), u'')
+        self.assertEqual(form.b._value(), u'9')
 
 
 class DecimalFieldTest(TestCase):

wtforms/fields.py

     def _value(self):
         if self.raw_data:
             return self.raw_data[0]
+        elif self.data is not None:
+            return unicode(self.data)
         else:
-            return self.data and unicode(self.data) or u'0'
+            return u''
 
     def process_formdata(self, valuelist):
         if valuelist:
     def _value(self):
         if self.raw_data:
             return self.raw_data[0]
+        elif self.data is not None:
+            return unicode(self.data)
         else:
-            return self.data and unicode(self.data) or u'0.0'
+            return u''
 
     def process_formdata(self, valuelist):
         if valuelist: