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

Argument with multiple occurrences #26

Closed
sylvainvivien opened this issue Oct 18, 2009 · 2 comments
Closed

Argument with multiple occurrences #26

sylvainvivien opened this issue Oct 18, 2009 · 2 comments

Comments

@sylvainvivien
Copy link

Like Google webapp : http://code.google.com/intl/fr/appengine/docs/python/tools/webapp/req...
it could be nice to have an "allow_multiple=True" in the get_argument
function. (or a get_all_argument)

Example : currently, if self.request.arguments returns {'key1':
['val3'], 'key2': ['val1', 'val2']}
self.get_argument(key2) will return 'val2'

and with an allow_multiple=True :
self.get_argument(key2, allow_multiple=True) it should return ['val1',
'val2']

I know it's possible to do : self.request.arguments['key2'], but here
we missed all unicode/utf-8 functions.

Another thing, in my example : {'key1': ['val3'], 'key2': ['val1',
'val2']}
For key1, that is not "multiple", self.request.arguments should return
{'key1': 'val3', 'key2': ['val1', 'val2']}.
i.e. : key1 should not be a list but a value.

I think it is the same issue with self.request.files, that always
returns a list even if there is only one file.

more info here : http://groups.google.com/group/python-tornado/browse_frm/thread/33325d1c500dccef/7af8756c4547b6bc

@jehiah
Copy link
Contributor

jehiah commented Apr 8, 2010

I've added a patch for this jehiah/tornado@cbe2eeb

My approach is to add a self.get_arguments() method modeled after self.get_argument()

@bdarnell
Copy link
Member

bdarnell commented Aug 4, 2010

RequestHandler now has a get_arguments() method.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants