Commits

Anonymous committed 8596447

Fix: FileInput widget doesn't add a `value=` attribute unless one exists to set. Fixes #57.

  • Participants
  • Parent commits 8fb79f6

Comments (0)

Files changed (1)

wtforms/widgets.py

         return super(RadioInput, self).__call__(field, **kwargs)
 
 
-class FileInput(Input):
+class FileInput(object):
     """
     Renders a file input chooser field.
     """
-    input_type = 'file'
+
+    def __call__(self, field, **kwargs):
+        kwargs.setdefault('id', field.id)
+        value = field._value()
+        if value:
+            kwargs.setdefault('value', value)
+        return HTMLString(u'<input %s />' % html_params(name=field.name, type=u'file', **kwargs))
 
 
 class SubmitInput(Input):