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

url parameters #82

Closed
oreza opened this issue Nov 14, 2015 · 3 comments

Comments

@oreza
Copy link

commented Nov 14, 2015

Hi,
I am new to Flask and I am very very new to webargs, I was wondering why you guys decided to treat segment parameters differently than other parameters (form, query, heads), view_args is part of request object and why not provide a view as location collection to parse the view_args and than before passing it back to the end point you can make sure it doest not exist kwargs.

Cheers

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 14, 2015

Are you referring to something like this?

@app.route('/<name>')
@use_args({'name': fields.Str(location='view_args')})
def hello(args, name):
    return 'Hello {}'.format(args['name'])

I suppose this might be OK. After all, aiohttpparser and pyramidparser have the match_info and matchdict locations.

My concern is how use_kwargs would interact with app.route, since the two will inject the same keyword arguments.

@oreza

This comment has been minimized.

Copy link
Author

commented Nov 14, 2015

Yes exactly,

I have not tested kwargs but wouldn't you be able to remove duplicate from kwargs before passing it the function (return func(_new_args, *_kwargs))?

If you want I can open a pull request, and you can look at it.

My personal reason for this is that I have existing API, that has lots of EP with URL segment parameters and I want to use your library but I want to keep unified way to parse and validate arguments.

Cheers,

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 17, 2015

I would gladly review a PR for this. Thanks in advance!

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.