def __init__(self, buf, filename=''): StringIO.__init__(self, buf) self.filename = filename
def setUp(self): super(FileWidgetTest, self).setUp() file = StringIO('Foo Value') file.filename = 'test.txt' self._widget.request.form['field.foo'] = file