Unpacking Argument Lists and Instantiating WTForms objects from web.py
- by Morris Cornell-Morgan
After a bit of searching, I've found that it's possible to instantiate a WTForms object in web.py using the following code:
form = my_form(**web.input())
web.input() returns a "dictionary-like" web.storage object, but without the double asterisks WTForms will raise an exception:
TypeError: formdata should be a multidict-type wrapper that…