Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Quetion about post fields #325

wsantos opened this Issue · 2 comments

2 participants


Why fields are in list in a post ?

(Pdb++) self.request.arguments
{'name': ['Cadaf'], 'email': ['']}

any reason for this ? thnx.


typically you don't access self.request.arguments directly but via self.get_argument() and self.get_arguments() docs

it's by design that it's a list so that the data type doesn't change between having one argument for that key, and multiple.


Thnx for the quick response, i got it. Btw i will register a simple way to use the post fields with wtform for future reference.

from wtforms import Form, TextField, validators

class TestForm(Form):
    field1     = TextField('field1', [validators.Length(min=4, max=25)])
    field2    = TextField('field2', [validators.Length(min=6, max=35)])

class HomeHandler(BaseHandler):

    def get(self):

    def post(self):
        form = TestForm(**dict([(key,self.get_argument(key)) for key in self.request.arguments]))
        validated = form.validate()

        self.write('Valid form: %r' % (validated))
@wsantos wsantos closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.