Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:33:26+00:00 2026-06-10T20:33:26+00:00

After a bit of searching, I’ve found that it’s possible to instantiate a WTForms

  • 0

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 supports the 'getlist' method

From the Python documentation I understand that the two asterisks are used to unpack a dictionary of named arguments. That said, I’m still a bit confused about exactly what is going on. What makes the web.storage object returned by web.input() “dictionary-like” enough that it can be unpacked by ** but not “dictionary-like” enough that it can be passed as-is to the WTForms constructor?

I know that this is an extremely basic question, but any advice to help a novice programmer would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:33:27+00:00Added an answer on June 10, 2026 at 8:33 pm

    From WTForms source:

    def process(self, formdata=None, obj=None, **kwargs):
        if formdata is not None and not hasattr(formdata, 'getlist'):
            if hasattr(formdata, 'getall'):
                formdata = WebobInputWrapper(formdata)
            else:
                raise TypeError("formdata should be a multidict-type wrapper that supports the 'getlist' method")
    
        for name, field, in iteritems(self._fields):
            if obj is not None and hasattr(obj, name):
                field.process(formdata, getattr(obj, name))
            elif name in kwargs:
                field.process(formdata, kwargs[name])
            else:
                field.process(formdata)
    

    You currently pass arguments as **kwargs, but if you want formdata to work, then it should be multidict-type that is not like a regular dict or webpy’s web.storage, because both of them don’t have getlist method. multidict is a dict that stores multiple values for the same key.

    You may try to pass web.input() as obj argument, like this: form = my_form(None, web.input()) I think it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After searching a bit on the net it seems that I can't map Ctrl
After a bit of searching and reading the documentation, it's clear that you can
after a bit of searching I was unable to find a helpful post so...
UPDATE: After searching a bit I don't seem to be alone about this problem:
After researching a bit how the different way people slugify titles, I've noticed that
After quite a bit of searching I think my situation is different enough I
After significant bit of searching around, I am still feeling quite clueless as to
So after a bit of searching for Win32 GUI tutorials (I decided a tutorial
After searching quite a bit in the Internet for a solution I decided to
Hiho, i have to copy an inputstream. And after a bit of searching in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.