id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 17631,edge case: django.test.client should handle fields and files with the same name,Damien Nozay,,"problem: - want to upload file with very common name, e.g. 'somefield' - want to post data with very common name for field, e.g. 'somefield' http://www.scotthawker.com/scott/?p=1892 http://code.activestate.com/recipes/146306/ {{{ >>> fields = { 'somefield': 1 } >>> files = { 'somefield': open('/dev/null', 'r') } >>> data = QueryDict('', mutable=True) >>> data.update(fields) >>> data.update(files) >>> data ]}> >>> data.items() [(u'somefield', )] >>> data ]}> >>> >>> from django.utils.datastructures import MultiValueDict >>> data = MultiValueDict() >>> data.update(fields) >>> data.update(files) >>> data ]}> >>> data.items() [('somefield', )] >>> data['somefield'] >>> data.getlist('somefield') [1, ] >>> }}} https://code.djangoproject.com/browser/django/trunk/django/test/client.py {{{ 116 # Each bit of the multipart form data could be either a form value or a 117 # file, or a *list* of form values and/or files. Remember that HTTP field 118 # names can be duplicated! 119 for (key, value) in data.items(): }}} IMHO, the test client should use data.lists() instead when providing MultiValueDict or subclass. ",Cleanup/optimization,new,Testing framework,1.3,Normal,,,oliver@…,Accepted,0,0,0,0,0,0