Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tornadoparser 'use_args' example in documentation has arguments transposed #100

Closed
frankslaughter opened this issue Apr 8, 2016 · 2 comments

Comments

@frankslaughter
Copy link

commented Apr 8, 2016

Arguments in the post method below are transposed. The id argument should come before reqargs, e.g. def post(self, id, reqargs):

More generally, the dictionary of parsed arguments is passed as a positional argument after self and any regex match groups which are passed by tornado as arguments to the request handler's get/post/etc. method.

from webargs import fields
from webargs.tornadoparser import use_args

class HelloHandler(tornado.web.RequestHandler):

    @use_args({'name': fields.Str()})
    def post(self, reqargs, id):
        response = {
            'message': 'Hello {}'.format(reqargs['name'])
        }
        self.write(response)

@sloria sloria closed this in fb97412 Apr 8, 2016

@sloria

This comment has been minimized.

Copy link
Member

commented Apr 8, 2016

Thanks for reporting. I've updated the docs with the correct behavior.

@frankslaughter

This comment has been minimized.

Copy link
Author

commented Apr 8, 2016

great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.