Mercurial > p > roundup > code
comparison test/test_cgi.py @ 8268:05d8806b25ad
fix: issue2551387 - TypeError: not indexable.
Fix crash due to uninitialized list element on a (Mini)FieldStorage
when unexpected input is posted via wsgi. This doesn't happen when
running roundup-server. It might happen under other front ends.
Moved the code that sets '.list = [] if .list == None' to the main
flow. Added an exception hander that logs the value of self.form if
self.form.list raises an AttributeError. This exception should never
happen if I understand the code correctly (but I probably don't).
Fixed a number of test cases that were broken because I was calling
Client and passing '[]' rather than a cgi.formStorage object.
Added test cases:
create a FileStorage (self.form) with .list = None.
check AttributeError exception and verify logging.
Problem reported and debugged by Christof Meerwald.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 12 Jan 2025 12:34:52 -0500 |
| parents | 35beff316883 |
| children | 669dfccca898 |
comparison
equal
deleted
inserted
replaced
| 8267:7f0c7966d204 | 8268:05d8806b25ad |
|---|---|
| 1868 | 1868 |
| 1869 out = [] | 1869 out = [] |
| 1870 def wh(s): | 1870 def wh(s): |
| 1871 out.append(s) | 1871 out.append(s) |
| 1872 | 1872 |
| 1873 # xmlrpc has no form content | 1873 # create form for xmlrpc from string |
| 1874 form = {} | 1874 form = db_test_base.makeFormFromString('xyzzy', |
| 1875 {"REQUEST_METHOD": "POST", | |
| 1876 "CONTENT_TYPE": "text/json"}) | |
| 1877 | |
| 1875 cl = client.Client(self.instance, None, | 1878 cl = client.Client(self.instance, None, |
| 1876 {'REQUEST_METHOD':'POST', | 1879 {'REQUEST_METHOD':'POST', |
| 1877 'PATH_INFO':'xmlrpc', | 1880 'PATH_INFO':'xmlrpc', |
| 1878 'CONTENT_TYPE': 'text/plain', | 1881 'CONTENT_TYPE': 'text/plain', |
| 1879 'HTTP_AUTHORIZATION': 'Basic YWRtaW46YWRtaW4=', | 1882 'HTTP_AUTHORIZATION': 'Basic YWRtaW46YWRtaW4=', |
